Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nhatnx/84a2aa8548a5e9ee4c6c0b16db773480 to your computer and use it in GitHub Desktop.
Save nhatnx/84a2aa8548a5e9ee4c6c0b16db773480 to your computer and use it in GitHub Desktop.
MySQL find_in_set with multiple search string
/*
Something likes find_in_set('a,b,c', 'a,b,c,d')
We can use OR:
find_in_set('a', 'a,b,c,d') OR find_in_set('b', 'a,b,c,d') OR find_in_set('b', 'a,b,c,d')
*/
WHERE CONCAT(",", `setcolumn`, ",") REGEXP ",(val1|val2|val3),"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment