SELECT COUNTY_DIC.COUNTYNAME,CARD_TYPE_DIC.CARD_TYPE,SUM(COUNTY_LIST.OUT_STORAGE_COUNT),floor(SUM(COUNTY_LIST.OUT_STORAGE_COUNT)/250)+1 FROM COUNTY_LIST LEFT JOIN (SELECT COUNTY_CODE,COUNTYNAME FROM COUNTY_DIC GROUP BY COUNTY_CODE,COUNTYNAME ) COUNTY_DIC ON COUNTY_LIST.COUNTY_CODE = COUNTY_DIC.COUNTY_CODE LEFT JOIN (SELECT TASK_ID,CARD_TYPE FROM TASK GROUP BY TASK_ID,CARD_TYPE) TASK ON COUNTY_LIST.TASK_ID = TASK.TASK_ID LEFT JOIN(SELECT CARD_TYPE_ID,CARD_TYPE FROM CARD_TYPE_DIC GROUP BY CARD_TYPE_ID,CARD_TYPE ) CARD_TYPE_DIC ON CARD_TYPE_DIC.CARD_TYPE_ID = TASK.CARD_TYPE WHERE TO_CHAR(SAVE_DATE,'yyyyMMdd') = #{save_Date} GROUP BY COUNTY_DIC.COUNTYNAME,CARD_TYPE_DIC.CARD_TYPE
SELECT * FROM GROUP_NO left join TASK on GROUP_NO.TASK_ID = TASK.TASK_ID where TASK_ID=#{task_Id}
select GROUP_NO,sum(VAILD_COUNT),sum(INVALID_COUNT),sum(SPECIAL_CARD_COUNT),COUNT(GROUP_NO) from TASK left join (select sum(VAILD_COUNT),sum(INVALID_COUNT),sum(SPECIAL_CARD_COUNT),COUNT(GROUP_NO),TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT from GROUP_NO group by TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT ) GROUP_NO on GROUP_NO.TASK_ID = TASK.TASK_ID where TASK.TASK_ID=#{task_Id} GROUP BY GROUP_NO
SELECT * FROM GROUP_NO left join TASK on GROUP_NO.TASK_ID = TASK.TASK_ID where TASK_STATE_ID=#{task_State_Id}
select GROUP_NO,sum(VAILD_COUNT),sum(INVALID_COUNT),sum(SPECIAL_CARD_COUNT),COUNT(GROUP_NO) from TASK left join (select sum(VAILD_COUNT),sum(INVALID_COUNT),sum(SPECIAL_CARD_COUNT),COUNT(GROUP_NO),TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT from GROUP_NO group by TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT ) GROUP_NO on GROUP_NO.TASK_ID = TASK.TASK_ID where TASK.TASK_STATE_ID=#{task_State_Id} GROUP BY GROUP_NO
SELECT * FROM GROUP_NO left join TASK on GROUP_NO.TASK_ID = TASK.TASK_ID where CARD_TYPE=#{card_type}
select GROUP_NO,sum(VAILD_COUNT),sum(INVALID_COUNT),sum(SPECIAL_CARD_COUNT),COUNT(GROUP_NO) from TASK left join (select sum(VAILD_COUNT),sum(INVALID_COUNT),sum(SPECIAL_CARD_COUNT),COUNT(GROUP_NO),TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT from GROUP_NO group by TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT ) GROUP_NO on GROUP_NO.TASK_ID = TASK.TASK_ID where TASK.CARD_TYPE=#{card_type} GROUP BY GROUP_NO
SELECT TASK.CARD_TYPE,count(CARD_TYPE_ID),CARD_TYPE_DIC.CARD_TYPE FROM TASK left join (SELECT CARD_TYPE,count(CARD_TYPE_ID),CARD_TYPE_ID FROM CARD_TYPE_DIC GROUP BY CARD_TYPE,CARD_TYPE_ID) CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = TASK.CARD_TYPE where TASK_STATE_ID=#{task_State_Id} GROUP BY CARD_TYPE_DIC.CARD_TYPE,TASK.CARD_TYPE
t_Type_List
AS(
select CARD_TYPE_ID,CARD_TYPE_DIC.CARD_TYPE from TASK left join CARD_TYPE_DIC on CARD_TYPE_DIC.CARD_TYPE_ID = TASK.CARD_TYPE where TASK_STATE_ID=#{task_State_Id}
),
t_Count_Card_Type
AS(
select CARD_TYPE_ID, count(CARD_TYPE_ID) qty from t_Type_List group by CARD_TYPE_ID
)
SELECT t1.CARD_TYPE_ID,t1.CARD_TYPE ,nvl(t2.qty,0) FROM t_Type_List t1 left join t_Count_Card_Type t2 on t1.CARD_TYPE_ID = t2.CARD_TYPE_ID
select CARD_TYPE,TASK.CITYCODE,CITYNAME,sum(VAILD_COUNT),sum(INVALID_COUNT),COUNT(GROUP_NO),GROUP_NO,TASK.TASK_ID,OLD_CARD_TYPE,SUBMIT_DATE,ISSUED_DATE,PRINT_STATE,DOWNLOAD_DATE,PRINT_OUT_DATE,POSITION_DATE,OUT_WORKSHOP_DATE,QUALITY_PEOPLE_NAME,QUALITY_TEST_DATE,EXCEPTION_INFORMATION,OUT_STORAGE_DATE,IN_STORAGE_DATE,TASK_STATE_ID,IS_EXCEPTION,PRINTER_ID from TASK left join (select sum(VAILD_COUNT),sum(INVALID_COUNT),COUNT(GROUP_NO),TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT from GROUP_NO group by TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT ) GROUP_NO on GROUP_NO.TASK_ID = TASK.TASK_ID left join (SELECT CITYCODE,CITYNAME FROM CITY_DIC) CITY_DIC on CITY_DIC.CITYCODE = TASK.CITYCODE where CARD_TYPE=#{card_Type} GROUP BY CARD_TYPE,TASK.CITYCODE,CITYNAME,GROUP_NO,TASK.TASK_ID,OLD_CARD_TYPE,SUBMIT_DATE,ISSUED_DATE,PRINT_STATE,DOWNLOAD_DATE,PRINT_OUT_DATE,POSITION_DATE,OUT_WORKSHOP_DATE,QUALITY_PEOPLE_NAME,QUALITY_TEST_DATE,EXCEPTION_INFORMATION,OUT_STORAGE_DATE,IN_STORAGE_DATE,TASK_STATE_ID,IS_EXCEPTION,PRINTER_ID
t_City_List
AS(
select GROUP_NO.GROUP_NO,CITY_DIC.CITYNAME,GROUP_NO.VAILD_COUNT,GROUP_NO.INVALID_COUNT,TASK.CITYCODE from TASK left join GROUP_NO on GROUP_NO.TASK_ID = TASK.TASK_ID left join CITY_DIC on TASK.CITYCODE=CITY_DIC.CITYCODE where CARD_TYPE=#{card_Type}
),
t_Count_VAILD_COUNT
AS(
select VAILD_COUNT, count(VAILD_COUNT) qty1 from t_City_List group by VAILD_COUNT
),
t_Count_INVALID_COUNT
AS(
select INVALID_COUNT, count(INVALID_COUNT) qty2 from t_City_List group by INVALID_COUNT
),
t_Sum_VAILD_COUNT
AS(
select VAILD_COUNT, SUM(VAILD_COUNT) qty3 from t_City_List group by VAILD_COUNT
)
SELECT t1.GROUP_NO,t1.CITYNAME,t1.CITYCODE,t1.VAILD_COUNT,t1.INVALID_COUNT,nvl(t2.qty1,0),nvl(t3.qty2,0),nvl(t4.qty3,0) FROM t_City_List t1 left join t_Count_VAILD_COUNT t2 on t1.VAILD_COUNT = t2.VAILD_COUNT left join t_Count_INVALID_COUNT t3 on t1.INVALID_COUNT=t3.INVALID_COUNT left join t_Sum_VAILD_COUNT t4 on t1.VAILD_COUNT=t4.VAILD_COUNT
select CARD_TYPE,TASK.CITYCODE,CITYNAME,sum(VAILD_COUNT),sum(INVALID_COUNT),COUNT(GROUP_NO),GROUP_NO,TASK.TASK_ID,OLD_CARD_TYPE,SUBMIT_DATE,ISSUED_DATE,PRINT_STATE,DOWNLOAD_DATE,PRINT_OUT_DATE,POSITION_DATE,OUT_WORKSHOP_DATE,QUALITY_PEOPLE_NAME,QUALITY_TEST_DATE,EXCEPTION_INFORMATION,OUT_STORAGE_DATE,IN_STORAGE_DATE,TASK_STATE_ID,IS_EXCEPTION,PRINTER_ID from TASK left join (select sum(VAILD_COUNT),sum(INVALID_COUNT),COUNT(GROUP_NO),TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT from GROUP_NO group by TASK_ID,GROUP_NO,SPECIAL_CARD_COUNT,VAILD_COUNT,INVALID_COUNT ) GROUP_NO on GROUP_NO.TASK_ID = TASK.TASK_ID left join (SELECT CITYCODE,CITYNAME FROM CITY_DIC) CITY_DIC on CITY_DIC.CITYCODE = TASK.CITYCODE where TASK_STATE_ID=#{task_State_Id} GROUP BY CARD_TYPE,TASK.CITYCODE,CITYNAME,GROUP_NO,TASK.TASK_ID,OLD_CARD_TYPE,SUBMIT_DATE,ISSUED_DATE,PRINT_STATE,DOWNLOAD_DATE,PRINT_OUT_DATE,POSITION_DATE,OUT_WORKSHOP_DATE,QUALITY_PEOPLE_NAME,QUALITY_TEST_DATE,EXCEPTION_INFORMATION,OUT_STORAGE_DATE,IN_STORAGE_DATE,TASK_STATE_ID,IS_EXCEPTION,PRINTER_ID
t_City_List
AS(
select GROUP_NO.GROUP_NO,CITY_DIC.CITYNAME,GROUP_NO.VAILD_COUNT,GROUP_NO.INVALID_COUNT,TASK.CITYCODE from TASK left join GROUP_NO on GROUP_NO.TASK_ID = TASK.TASK_ID left join CITY_DIC on TASK.CITYCODE=CITY_DIC.CITYCODE where TASK_STATE_ID=#{task_State_Id}
),
t_Count_VAILD_COUNT
AS(
select VAILD_COUNT, count(VAILD_COUNT) qty1 from t_City_List group by VAILD_COUNT
),
t_Count_INVALID_COUNT
AS(
select INVALID_COUNT, count(INVALID_COUNT) qty2 from t_City_List group by INVALID_COUNT
),
t_Sum_VAILD_COUNT
AS(
select VAILD_COUNT, SUM(VAILD_COUNT) qty3 from t_City_List group by VAILD_COUNT
)
SELECT t1.GROUP_NO,t1.CITYNAME,t1.CITYCODE,t1.VAILD_COUNT,t1.INVALID_COUNT,nvl(t2.qty1,0),nvl(t3.qty2,0),nvl(t4.qty3,0) FROM t_City_List t1 left join t_Count_VAILD_COUNT t2 on t1.VAILD_COUNT = t2.VAILD_COUNT left join t_Count_INVALID_COUNT t3 on t1.INVALID_COUNT=t3.INVALID_COUNT left join t_Sum_VAILD_COUNT t4 on t1.VAILD_COUNT=t4.VAILD_COUNT