trevor1940
asked on
SQL: Can you combine LIKE and IN within a single query?
Hi
Can you combine LIKE and IN within a single MYSQL query?
I have a list of codes I need to search for something like this
The problem is the column codes contains a coma separated list eg "ABC,EFG,XYZ" so a standard IN clause wont work
Can you combine LIKE and IN within a single MYSQL query?
I have a list of codes I need to search for something like this
select * FROM mytable WHERE codes LIKE '%ABC%' OR code LIKE '%XYZ%';
The problem is the column codes contains a coma separated list eg "ABC,EFG,XYZ" so a standard IN clause wont work
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I went with first comment because it is simpler to code via external perl script
Also The second comment mentions Using the built-in (SQL Server 2016+) unsure if MYSQL has this function
Also The second comment mentions Using the built-in (SQL Server 2016+) unsure if MYSQL has this function
Open in new window