If I need to search for some data, I can use wildcards and use a simple query -
SELECT * FROM TABLE WHERE COL1 LIKE '%test_string%'
And, if I need to view many values, I can use -
SELECT * FROM TABLE WHERE COL1 IN (Select col from AnotherTable)
But is it possible to use both together. That is, the query does not just execute WHERE IN, but also does something like WHERE LIKE? A query that simply does not look up a set of values, but searches using wildcards using a set of values.
If this is not clear, I can give an example. Let me know. Thank.
Example -
consider -
AnotherTable -
id | Col
------|------
1 | one
2 | two
3 | three
Table -
Col | Col1
------|------
aa | one
bb | two
cc | three
dd | four
ee | one_two
bb | three_two
Now if i can use
SELECT * FROM TABLE WHERE COL1 IN (Select col from AnotherTable)
It gives me -
Col | Col1
------|------
aa | one
bb | two
cc | three
But what if I need to -
Col | Col1
------|------
aa | one
bb | two
cc | three
ee | one_two
bb | three_two
I think this should help you understand what I mean by using WHERE IN and LIKE together