select GROUP_CONCAT(DISTINCT tbl1.logid) ,
(
SELECT COUNT( DISTINCT tbl2.client_id )
FROM tbl_client tbl2
WHERE tbl2.con_id
IN ( GROUP_CONCAT(DISTINCT tbl1.logid) )
) as PC2,
from tbl_table tbl1;
i try to assign an alias of GROUP_CONCAT(DISTINCT tbl1.logid) and place it in the value inside the IN() but still it doesn’t work out
the parent query returns something like 12,34,3,56
and that i want to use in the IN function
this not actually the whole case, but i just want to figure this out,
You cannot use the output of GROUP_CONCAT for IN() as it is returning a string. Use the result of a subquery for IN().