顺丰2109
一、

select a.userid, a.paper, a.entertainment, a.food, b.class
from
(select userid,sum(if(class='文件', count, 0)) as paper,sum(if(class='娱乐', count, 0)) as entertainment,sum(if(class='', count, 0)) as food,max(count) as most_class
from(select userid, class, count(*) as countfrom waybill_constypewhere month(consign_day)=4group by userid, class
) as a
group by userid
) as a
left join (select userid, class, count(*) as countfrom waybill_constypewhere month(consign_day)=4group by userid, class) as b
on a.userid=b.userid and a.most_class=b.count
二、

select a.task_no, sum(transfer_fee) as total_transfer_fee
from task_arrive_transfer as a
join task_operate as b
on a.task_no=b.task_no and month(b.start_time)=8and a.arrive_time between b.start_time and b.end_time
group by a.task_no
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
