sql - How to get a list from comma seperated data in mysql -
i want use sql this:
select * product productid in (select relatedproductids product productid = 11)
relatedproductids
contains '2286,11212,11031,11212,11212,4082,9339,9214'
do have suggestion?
use find_in_set()
select a.* product inner join product b on find_in_set(a.productid, b.relatedproductids) > 0 b.productid = 11
as advice, should normalize table. saving comma separated value in column bad design.
Comments
Post a Comment