I understand that LIKE
can not be used in inside IN
clause from here.
My table has col1, col2, col3
columns.
How can I find multiple values in multiple columns using LIKE operator. Currently my query is:
SELECT col1, col2, col3
FROM table_name
WHERE
(
Col1 = '38'
OR Col1 LIKE '%,38'
OR Col1 LIKE '%,38,%'
OR Col1 LIKE '38,%'
)
OR
(
col2 = '38'
OR col2 LIKE '%,38'
OR col2 LIKE '%,38,%'
OR col2 LIKE '38,%'
)
OR
(
col3 = '38'
OR col3 LIKE '%,38'
OR col3 LIKE '%,38,%'
OR col3 LIKE '38,%'
)
Is there a way make it smarter/shorter/faster? Thanks.!