刷到一题:查找每个日期、销售的不同产品的数量及其名称
其中某一天,有多个产品,但是直接查询只返回第一个数据,用group_concat可合并列拼接在一行,用separator分隔
示例:
select sell_date,count(distinct(product)) num_sold,
group_concat(distinct(product) order by product SEPARATOR ",") as products
from Activities group by sell_date order by sell_date;