• sql


    select
    tb.isPRproject,
    if(b.HasYes  is null,0,b.HasYes) as  HasYes,
    a.HasNo,
    case
    when d.name='单一采购'
    then '单一采购' when d.name='邀请招标'
    then '邀请招标'
    when d.name='快速采购'
    then '快速采购(5-50万)' end
    as proMethod,
     count(case
    when tb.Suppliers_Recommended_Date_Fact = '0000-00-00 00:00:00'
    then null  
    else tb.Suppliers_Recommended_Date_Fact end ) as supReDateFact,
    count(case
    when tb.evaluation_Methods_Date_Fact = '0000-00-00 00:00:00'
    then null  
    else tb.evaluation_Methods_Date_Fact end) as evaMethDateFact,
     count(case when tb.bid_Date_Fact = '0000-00-00 00:00:00'then
    null  else tb.bid_Date_Fact end) as bidDateFact,
    count(case when tb.inquiry_Issued_Date_Fact = '0000-00-00 00:00:00'then
    null  else tb.inquiry_Issued_Date_Fact end) as inqIssDateFact,
    count(case when tp.purchase_mrzheng_endtime = '0000-00-00 00:00:00'then
    null  else tp.purchase_mrzheng_endtime end) as proRecConfirmDateFact,
    count(case when tp.contract_mrzheng_endtime = '0000-00-00 00:00:00'then null  
    else tp.contract_mrzheng_endtime end) as conAppDateFact
     from tb_pmi_project_management tb
    left join
    tb_purchase_check tp
    on tb.requisition_Num = tp.requisition_Num
    left join system_dict d on d.code=tb.procurement_Method
    left join
    (select case when d.name='邀请招标' then '邀请招标(>=50万)'
    when d.name='单一采购' then '单一采购' when d.name='快速采购' then '快速采购(5-50万)' end as proMethod,s.procurement_Method,count(s.isPRproject )as HasNo
    from  tb_pmi_project_management s
    left join system_dict d on d.code=s.procurement_Method
    where s.is_Count =1 and s.isDelete = 0 and s.isPRproject = 0
    and year(s.PR_Reception_Time) = YEAR(NOW( )) and s.budgetyear = YEAR(NOW( )) group by s.isPRproject,s.procurement_Method
    ) a
    on
    tb.procurement_Method = a.procurement_Method
    left join
    (select case when d.name='邀请招标' then '邀请招标(>=50万)'
    when d.name='单一采购' then '单一采购' when d.name='快速采购' then '快速采购(5-50万)' end as proMethod,s.procurement_Method,sum(s.isPRproject )as HasYes
    from  tb_pmi_project_management s
    left join system_dict d on d.code=s.procurement_Method
    where s.is_Count =1 and s.isDelete = 0 and s.isPRproject = 1
    and year(s.PR_Reception_Time) = YEAR(NOW( )) and s.budgetyear = YEAR(NOW( )) group by s.isPRproject,s.procurement_Method
    ) b
    on
    tb.procurement_Method = b.procurement_Method
    where tb.is_Count =1
    and tb.isDelete = 0
    and year(tb.PR_Reception_Time) = YEAR(NOW( ))
    and tb.budgetyear = YEAR(NOW( ))  
    group by
    tb.procurement_Method

  • 相关阅读:
    Failed to parse PID from file /run/nginx.pid: Invalid argument
    Ubuntu16.04环境下bashrc文件位置
    virtualenvwrapper.sh报错: There was a problem running the initialization hooks.解决
    pip安装virtualenvwrapper报错的解决办法
    争鸣|函数性质的综合应用辨析
    总结|静雅斋之2020高考备考回顾总结
    2020年全国卷Ⅱ卷文科数学图片版
    奇怪|说好的求最大值变成了求最小值
    探究|平面向量探究题
    平面向量错误收集
  • 原文地址:https://www.cnblogs.com/SH03/p/5392515.html
Copyright © 2020-2023  润新知