Code: Select all
SELECT *
FROM aaa
WHERE aaa.field1 like '%some_stuff1%' or
aaa.field1 like '%some_stuff2%'
aaa.field1 like '%some_stuff3%'
aaa.field1 like '%some_stuff4%'
aaa.field1 like '%some_stuff5%'
table aaa
id field1
-- ------
1 some_stuff2
2 some_stuff5
3 some_stuff1
4 some_stuff3
Can I include a matching criteria (some_stuff) in selected fields?
the result should look like this
Code: Select all
id field1 select_criteria
-- ------ ---------------
1 some_stuff2 %some_stuff2%
2 some_stuff5 %some_stuff5%
3 some_stuff1 %some_stuff1%
4 some_stuff3 %some_stuff3%
and this is going on on ORACLE database.