Created
May 24, 2019 17:34
-
-
Save nhatnx/84a2aa8548a5e9ee4c6c0b16db773480 to your computer and use it in GitHub Desktop.
MySQL find_in_set with multiple search string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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