postgre数据清洗

流过昼夜 提交于 2019-12-05 14:33:52
select
    "BATCH_NUMBER" as batchNumber,
    count(1) as applyNum
from (
     select
         "BATCH_NUMBER"
     from (
            select
              "BATCH_NUMBER",
               row_number() over(partition by  "PT_NAME","BATCH_NUMBER","POLICY_NAME") as rown
            from syc_industry_support_policy where data_status='1' and "STAT"='申请成功' and "BATCH_NUMBER" like
            (to_char((SELECT now()::timestamp),'yyyy')||'%')
     ) t where t.rown=1
)t1 group by "BATCH_NUMBER"
order by cast( "BATCH_NUMBER" as numeric) desc
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!