Forum Moderators: open
I need to write a MySql query that will only select entries from a database table where one of the columns only contains a certain character.
My "column A" contains an array of numbers seperated by comas (i.e. 1,3,5,7)
I only want to select records in which this "column A" contains a "3"
Can i do this through the query?
How is best to accomplish this?
Hope this makes sense..
Russ
SELECT * FROM table WHERE columna = '3' OR columna LIKE '3,%' OR columna LIKE '%,3,%' OR columna LIKE '%,3'
You could also use a regular expression, but I reckon this method would be quicker.