SELECT A.id, A.title,
FROM (`table`) as A
WHERE A.active = '1'
AND A.id IN (SELECT GROUP_CONCAT(B.id) from B where user = 3)
如果我僅啓動子查詢SELECT GROUP_CONCAT(B.id) from B where user = 3
,則獲得1,2,3,4。但是,如果我啓動整個查詢,我只獲得一行。IN子查詢中的GROUP_CONCAT
但如果我嘗試用它的值(1,2,3,4)
SELECT A.id, A.title,
FROM (`table`) as A
WHERE A.active = '1'
AND A.id IN (1,2,3,4)
替代子查詢我獲得4行...因爲我需要。
我的錯誤在哪裏?