统计某些状态总数sql

 统计某些状态总数sql

select
        ne.plan_uuid as plan_uuid,
        ne.checkunit_name as checkunit_name,
        ne.checkunit_uuid as checkunit_uuid,
        count(*) as total, --总数
        sum(case
            when detail.status>='200' 
             and  detail.status<>'201'  then 1
            else 0
        end) as pass ,--通过
        sum(case
            when detail.status='201' then 1
            else 0
        end) as unPass,--没通过
        sum(case
            when detail.check_ispass is null then 1
            else 0
        end) as unRecord--没到
    from
        nation_examineedetail detail,
        nation_examineedate ne
    where
        detail.isdel<>1
        and ne.isdel<>1
        and detail.uuid=ne.detail_uuid
        and ne.plan_uuid='cbaa6d10-68a6-4ac2-8932-dd87c00f16fd'
        and ne.checkunit_uuid='cb6fa693-48db-4834-bcec-b948973f7ce2'
    group by
        ne.plan_uuid ,
        ne.checkunit_name ,
        ne.checkunit_uuid

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值