Possible with one MySQL query? "column contains any of the array's values" -


basically want check whether mysql text column, contains comma-separated values, contains of values contained in array. know can done loop , multiple queries, hoping single query. possible? thank you.

i use solution this:

select   *   yourtable   str rlike   concat('[[:<:]]', replace('values,in,the,array', ',', '[[:>:]]|[[:<:]]'), '[[:>:]]') 

this make following string:

'values,in,the,array' 

like this:

[[:<:]]values[[:>:]]|[[:<:]]in[[:>:]]|[[:<:]]the[[:>:]]|[[:<:]]array[[:>:]] 

[[:<:]] , [[:>:]] word boundaries match whole words, , | or match of words. please see fiddle here.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -