zoukankan      html  css  js  c++  java
  • NDRS SQL

    SCDF Count Sql

    SELECT DISTINCT (SELECT COUNT (1)
    FROM tbl_ndr_tra_reg a
    WHERE a.form_type = 'SCDF'
    AND a.delete_ind = 'N'
    AND a.SCDF_INCIDENT_DT BETWEEN TO_DATE ('#edFromDate#',
    'dd/MM/yyyy'
    )
    AND TO_DATE ('#edtoDate#',
    'dd/MM/yyyy'
    )) scdfnotconvey,
    (SELECT COUNT (1)
    FROM tbl_ndr_tra_reg a,
    tbl_ndr_tra_raw_scdf b,
    tbl_ndr_tra_link c
    WHERE a.delete_ind = 'N'
    AND b.delete_ind = 'N'
    AND c.delete_ind = 'N'
    AND a.rec_no = c.rec1
    AND b.rec_no = c.rec2
    AND a.scdf_incident_no = b.scdf_incident_no
    AND a.scdf_call_sign_no = b.scdf_call_sign_no
    AND a.scdf_info_st = 'Y'
    AND b.linking_st = 'L'
    AND a.form_type = 'ITS'
    AND a.SCDF_INCIDENT_DT BETWEEN TO_DATE ('#edFromDate#',
    'dd/MM/yyyy'
    )
    AND TO_DATE ('#edtoDate#',
    'dd/MM/yyyy'
    )) scdflinked,
    (SELECT COUNT (1)
    FROM tbl_ndr_tra_raw_scdf a
    WHERE a.delete_ind = 'N'
    AND a.linking_st IN ('O', 'S', 'D', 'X')
    AND a.SCDF_INCIDENT_DT BETWEEN TO_DATE ('#edFromDate#',
    'dd/MM/yyyy'
    )
    AND TO_DATE ('#edtoDate#',
    'dd/MM/yyyy'
    )) osdx,
    (SELECT COUNT (1)
    FROM (SELECT DISTINCT a.exception_no
    FROM tbl_ndr_tra_exception a,
    tbl_ndr_tra_follow_up b,
    tbl_ndr_tra_raw_scdf c
    WHERE a.exception_no = b.follow_up_rec_no
    AND a.exception_type LIKE ('SCDF_ERR%')
    AND b.follow_up_status IN ('P', 'A')
    AND a.rec_no2 = c.rec_no
    AND a.delete_ind = 'N'
    AND b.delete_ind = 'N'
    AND c.delete_ind = 'N'
    AND c.SCDF_INCIDENT_DT BETWEEN TO_DATE ('#edFromDate#',
    'dd/MM/yyyy'
    )
    AND TO_DATE ('#edtoDate#',
    'dd/MM/yyyy'
    )))
    scdfexceptions
    FROM tbl_ndr_tra_reg


     

    BID COUNT SQL

     SELECT DISTINCT (  (SELECT COUNT (1)
    FROM tbl_ndr_tra_reg a
    WHERE a.form_type = 'BID'
    AND a.reg_no is not null
    AND a.delete_ind = 'N'
    AND a.bid_online_add_st = 'Y'
    AND a.hsa_death_dt >= TO_DATE ('#edFromDate#', 'dd/MM/yyyy')
    AND a.hsa_death_dt <= TO_DATE ('#edtoDate#', 'dd/MM/yyyy')
    )
    + (SELECT COUNT (1)
    FROM tbl_ndr_tra_reg a, tbl_ndr_tra_raw_bid b
    WHERE a.form_type = 'BID'
    AND a.delete_ind = 'N'
    AND b.delete_ind = 'N'
    AND a.reg_no is not null
    AND b.linking_st Not IN ('D', 'X')
    AND a.hsa_bid_id = b.hsa_bid_case_id
    AND b.linking_st = 'C'
    AND a.bid_online_add_st IS NULL
    AND a.hsa_death_dt >= TO_DATE ('#edFromDate#', 'dd/MM/yyyy')
    AND a.hsa_death_dt <= TO_DATE ('#edtoDate#', 'dd/MM/yyyy')
    )
    ) stand_alone_count,
    (SELECT COUNT (1)
    FROM tbl_ndr_tra_reg a,
    tbl_ndr_tra_raw_bid b,
    tbl_ndr_tra_link c
    WHERE a.delete_ind = 'N'
    AND b.delete_ind = 'N'
    AND c.delete_ind = 'N'
    AND a.hsa_bid_id = b.hsa_bid_case_id
    AND a.hsa_bid_info = 'Y'
    AND b.linking_st = 'L'
    AND a.form_type = 'ITS'
    AND a.rec_no = c.rec1
    AND b.rec_no = c.rec2
    AND a.hsa_death_dt >= TO_DATE ('#edFromDate#', 'dd/MM/yyyy')
    AND a.hsa_death_dt <= TO_DATE ('#edtoDate#', 'dd/MM/yyyy')
    ) link_ntr_count,
    (SELECT COUNT (1)
    FROM tbl_ndr_tra_raw_bid a
    WHERE a.delete_ind = 'N'
    AND a.linking_st IN ('D', 'X')
    AND a.hsa_death_dt >= TO_DATE ('#edFromDate#', 'dd/MM/yyyy')
    AND a.hsa_death_dt <= TO_DATE ('#edtoDate#', 'dd/MM/yyyy')
    ) draft_count,
    (SELECT COUNT (1)
    FROM (SELECT DISTINCT a.exception_no
    FROM tbl_ndr_tra_exception a,
    tbl_ndr_tra_follow_up b,
    tbl_ndr_tra_raw_bid c
    WHERE a.exception_no = b.follow_up_rec_no
    AND a.exception_type LIKE ('BID_ERR%')
    AND b.follow_up_status IN ('P', 'A')
    AND a.rec_no2 = c.rec_no
    AND c.delete_ind = 'N'
    AND a.delete_ind = 'N'
    AND b.delete_ind = 'N'
    AND c.hsa_death_dt >= TO_DATE ('#edFromDate#', 'dd/MM/yyyy')
    AND c.hsa_death_dt <= TO_DATE ('#edtoDate#', 'dd/MM/yyyy')
    )) exception_count
    FROM tbl_ndr_tra_link


  • 相关阅读:
    进程通信之信号通信
    分数化小数
    台湾大学公开课《概率》第五周一道不会作的作业题 ,一种看不懂的解法
    网络子系统53_ip协议分片重组_内存阈值
    Centos 6.3 Realtek Audio Driver Compile
    I.MX6 PHY fixup 调用流程 hacking
    I.MX6 AR8031 寄存器操作
    I.MX6 ethtool 移植
    I.MX6 U-Boot ping网络
    Android tcpdump 使用
  • 原文地址:https://www.cnblogs.com/skrifer/p/2311977.html
Copyright © 2011-2022 走看看