现在有一个统计表(departmentName,time,status(状态有三种))
我现在给出的有条件有 departmentName,startTime,endTime,
要选出每个departmentName,在开始和结束时间里面,的不同status的数量和在这个时间里面的总数,,,得到下表:
(部门名称,订单总数,未出货订单数,已出货订单数,以签收订单数)
求大神赐教!!!!
现在有一个统计表(departmentName,time,status(状态有三种))
我现在给出的有条件有 departmentName,startTime,endTime,
要选出每个departmentName,在开始和结束时间里面,的不同status的数量和在这个时间里面的总数,,,得到下表:
(部门名称,订单总数,未出货订单数,已出货订单数,以签收订单数)
求大神赐教!!!!
select 部门名称, sun(订单总数) , sun(未出货订单数) ,sun(已出货订单数),sun(以签收订单数), from a where startTime<=time and endTime>=time group by departmentName,status