SELECT * FROM COUNTY_LIST left join TASK on COUNTY_LIST.TASK_ID = TASK.TASK_ID left join CARD_TYPE_DIC on TASK.CARD_TYPE = CARD_TYPE_DIC.CARD_TYPE_ID where CARD_TYPE_DIC.CARD_TYPE=#{card_Type}
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 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 substr(TO_CHAR(SAVE_DATE,'yyyyMMdd'),0,8) >= #{startDate}
AND #{endDate} >= substr(TO_CHAR(SAVE_DATE,'yyyyMMdd'),0,8)
GROUP BY COUNTY_DIC.COUNTYNAME,CARD_TYPE_DIC.CARD_TYPE
select POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,GAJG_DM.GAJG_MC,COUNTY_DIC.COUNTYNAME,CITY_DIC.CITYNAME from POLICE_STATION_APPLY_REASON left join GAJG_DM on GAJG_DM.GAJG_DM = POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = substr(POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,0,5) left join CITY_DIC on CITY_DIC.CITYCODE = substr(POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,0,3) where CITYCODE=#{citycode}
select POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,GAJG_DM.GAJG_MC,COUNTY_DIC.COUNTYNAME,CITY_DIC.CITYNAME from POLICE_STATION_APPLY_REASON left join GAJG_DM on GAJG_DM.GAJG_DM = POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = substr(POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,0,5) left join CITY_DIC on CITY_DIC.CITYCODE = substr(POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,0,3) where COUNTY_CODE=#{county_Code}
select POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,GAJG_DM.GAJG_MC,COUNTY_DIC.COUNTYNAME,CITY_DIC.CITYNAME from POLICE_STATION_APPLY_REASON left join GAJG_DM on GAJG_DM.GAJG_DM = POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE left join COUNTY_DIC on COUNTY_DIC.COUNTY_CODE = substr(POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,0,5) left join CITY_DIC on CITY_DIC.CITYCODE = substr(POLICE_STATION_APPLY_REASON.POLICE_STATION_CODE,0,3) where POLICE_STATION_CODE=#{police_Station_Code}
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
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
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
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
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
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