-1

How do you query to a comma separated value? In a table I have a column named colors it contains color-codes like this 1,5,8.

How do i check whether, for example value 5, is within the comma separated column colors?

Is this even possible to do with MySQL?

ps: it is possible that there is a single value within the column 'colors'

James Z
  • 12,104
  • 10
  • 27
  • 43
Aapje
  • 1
  • 3
  • 3
    Possible duplicate [http://stackoverflow.com/questions/5033047/mysql-query-finding-values-in-a-comma-separated-string](http://stackoverflow.com/questions/5033047/mysql-query-finding-values-in-a-comma-separated-string) – Il Vic Jun 08 '15 at 14:10

1 Answers1

1

You can use find_in_set('5', colors) for that.

But it is no good practice to store values as csv.

Jens
  • 63,364
  • 15
  • 92
  • 104