I have read all the related questions but could not get this simple thing working. I’d like to concatenate the results of this query:
SELECT DISTINCT ord.uid AS u
FROM `uc_order_products` ord_prod, `uc_orders` ord, `uc_roles_expirations` re
WHERE ord.order_id = ord_prod.order_id
AND ord_prod.title LIKE '2012. évi%'
AND ord.uid NOT
IN (SELECT uid FROM uc_roles_expirations re)
It looks like this:
U
----
1234
1235
...
This is what I tried:
SELECT GROUP_CONCAT(DISTINCT ord.uid AS u
FROM `uc_order_products` ord_prod, `uc_orders` ord, `uc_roles_expirations` re
WHERE ord.order_id = ord_prod.order_id
AND ord_prod.title LIKE '2012. évi%'
AND ord.uid NOT
IN (SELECT uid FROM uc_roles_expirations re) SEPARATOR ',')
..and did not work. Could you help me?
only the columnName should be in the
GROUP_CONCATfunction.PS: As side note, this uqery will produce a cartesian result due to lacking of join condition on this table
uc_roles_expirations. What is the relationship of the table on the other table?I’m not sure, but I think you want the result of this query,