I have a table with several fields and one field having 3 Comma Separated Values
Column 1 Column 2
1 1,2,3
2 2,3,4
3 6,7,8
You can use FIND_IN_SET()
:
SELECT column1 FROM table WHERE FIND_IN_SET('2', column2) != 0
The IN
operator is basically a shortcut for lots of ORs:
WHERE column2 = IN ('a', 'b', 'c')
gives the same result as
WHERE (column2 = 'a' OR column2 = 'b' OR column2 = 'c')
If I have understood your question correctly then how about trying - select Column1, Column2 from Table where Column1 <=
cheers
You should be able to use Like to do this, something like:
SELECT * FROM tablename WHERE [Column 2] LIKE ("%2%");