sql按照日期和人分组显示

      select
            date_format(approve_time ,'%Y-%m-%d' )  approveTime,
            trial_person approvePerson,
            count(order_status='11' or order_status='12' or NULL) approveTotalCount,
            count(order_status='12' or NULL) unPassCount,
            count(order_status='11' or NULL) passCount,
            concat(truncate((count(order_status='11' or NULL)/count(order_status='11' or order_status='12' or NULL)) * 100, 2), '%')  passRate,
            concat(truncate((count(order_status='12' or NULL)/count(order_status='11' or order_status='12' or NULL)) * 100, 2), '%') unPassRate,
            count(reject_type='1' or NULL) bigButLIttleCount,
            count(reject_type='2' or NULL) littleButBigCount,
            count(reject_type='3' or NULL) vehicleTypeErrorCount,
            count(reject_type='4' or NULL) vehicleColorErrorCount,
            count(reject_type='5' or NULL) vehicleLicenseErrorCount,
            count(reject_type='6' or NULL) cardNotSuitCount,
            count(reject_type='7' or NULL) errorVehicleTypeCount,
            count(reject_type='8' or NULL) otherCount
        from
            tb_online_retailers_check_order

 

 

效果

 

posted @ 2022-10-20 10:29  Joker-0927  阅读(385)  评论(0编辑  收藏  举报
// 侧边栏目录