a:主表 b_ids(逗号分隔状态) 比如 1,2,3
b:子表 id
单个匹配:
b id=1010
LOCATE(CONCAT(',', 1010, ','), CONCAT(',', a.b_ids, ',')) != 0
多个匹配:
b id=1010 id=1011
LOCATE(CONCAT(',', 1010, ','), CONCAT(',', a.b_ids, ',')) != 0
OR
LOCATE(CONCAT(',', 1011, ','), CONCAT(',', a.b_ids, ',')) != 0