【发布时间】:2020-11-02 11:12:45
【问题描述】:
我有以下查询,它从表中获取数据并将所有产品组合到一列中并计算该订单的数量。
我需要在输出中添加一个额外的列,我怎样才能添加ship_date?
select order_id, group_concat(product_id, ' - ', cnt separator ', ') as products, sum(cnt) as total
from (select order_id, product_id, count(*) as cnt
from tt_order_items
group by order_id, product_id
) op
group by order_id;
这是原始表格的布局方式:
这就是查询输出结果的方式:
如何将ship_date 添加到该输出?
【问题讨论】:
-
请显示您想要的结果。