mysql: can I do a for-each on a comma separated field?
- by Tillebeck
Just ran into a problem
I know these integers, $integers: 3,5,15,20
I only want to select the rows from this following table where all comma separated INT's from the field NUMBERS are found.
TABLE: number_table
Uid Numbers
------------------------
1 3,5,15 OK, since all of NUMBERS are in $integers
2 5,15,20 OK, since all of NUMBERS are in $integers
3 3,4,5,15 NOT OK, since 4 is not found in $integers
4 2,15,20,25 NOT OK, since 2 and 25 is not found in $integers
Is it possible to to a "for-each" on a comma separated string or another way to do this SELECT?