web | Java

订单表order,字段有:order_id(订单ID), user_id(用户ID),amount(金额), pay_datetime(付费时间),channel_id(渠道ID),dt(分区字段) 2)查询dt=‘2021-08-04‘里每个渠道的订单数,下单人数(去重),总金额

千锋教育

select channel_id, count(order_id) 


`订单数`, count(distinct user_id) 


`下单人数`, sum(amount) 


`总金额` from order where dt = '2021-08-04' group by channel_id