Question changed
Really wanted group_concat sums ...
Table: shops
+---------+--------+--------+ | shop_id | name | state | +---------+--------+--------+ | 0 | shop 0 | 5 | | 1 | shop 1 | 5 | | 2 | shop 2 | 5 | | 3 | shop 3 | 2 | +---------+--------+--------+
Table: items
+------------+--------------+ | shop | item | quantity | +------------+--------------+ | 0 | 0 | 1 | | 0 | 1 | 2 | | 0 | 2 | 3 | | 1 | 0 | 1 | | 1 | 1 | 2 | | 1 | 2 | 3 | | 2 | 0 | 1 | | 2 | 1 | 2 | | 2 | 2 | 3 | | 3 | 0 | 1 | | 3 | 1 | 2 | | 3 | 2 | 3 | +------------+--------------+ SELECT state,SUM(i.quantity) total FROM shops s2 LEFT JOIN items i ON i.shop=s2.shopid WHERE state=5 GROUP by item result
I cannot get group_concat to capture the resulting column as a result of # 1
Thanks in advance
mysql group-concat sum
Mahks
source share