我有一个以y作为列的表X
x.y值基本上是用逗号分隔的字符串,例如
X.y = hello,world
现在我有另一个表A,该表的ID和B列
id b
1 hello
2 world
现在,我正在写一个查询:
SELECT
(SELECT count(id) FROM A
where b IN (CONCAT("'",REPLACE(X.y,"'","','"),"'"))) as aCount
FROM X
它显示0,而应该显示2,因为
CONCAT("'",REPLACE(X.y,"'","','"),"'")
可能是'hello','world'