SELECT A.ORG_CODE, 
C.ORG_NAME, 
A.UNIT_CODE,
EE.UNIT_NAME AS UNIT_NAME,
A.DOC_YEAR,
A.DOC_YEAR_NO,
A.VOL_NO,
A.ORG_CODE||'-'||A.UNIT_CODE||'-'||A.DOC_YEAR||'-'||A.DOC_YEAR_NO||'-'||A.VOL_NO AS DOC_NO,
A.COLL_YEAR AS COLL_YEAR, 
A.DOC_STATUS_FLAG AS DOC_STATUS_FLAG,
A.DOC_RESULT_FLAG AS DOC_RESULT_FLAG,
A.DOC_TITLE AS DOC_TITLE,
A.DET_CNT AS DET_CNT,
A.DOC_END_FLAG AS DOC_END_FLAG,
A.DOC_TYPE AS DOC_TYPE,
A.DOC_END_YEAR AS DOC_END_YEAR,
A.DOC_TERM AS DOC_TERM,
A.DOC_METHOD AS DOC_METHOD,
A.DOC_PLACE AS DOC_PLACE,
A.KEEP_END_DT AS KEEP_END_DT,
A.USER_NAME AS USER_NAME,
A.KEEP_DESC AS KEEP_DESC,
A.OLD_ORG_NAME AS OLD_ORG_NAME,
A.ERR_DESC AS ERR_DESC,
A.OLD_CODE AS OLD_CODE,
A.DOC_FLAG AS DOC_FLAG,
A.DET_PAGE_CNT AS DET_PAGE_CNT,
A.DET_FILE_CNT AS DET_FILE_CNT,
B.FILE_FLAG AS FILE_FLAG,
A.DOC_API_FLAG AS DOC_API_FLAG
FROM SW_DOCUMENT01 A
   INNER JOIN SW_DETAIL01 B
   ON  (A.ORG_CODE = B.ORG_CODE)  
   AND  (A.UNIT_CODE = B.UNIT_CODE)  
   AND  (A.DOC_YEAR = B.DOC_YEAR)  
   AND  (A.DOC_YEAR_NO = B.DOC_YEAR_NO)  
   AND  (A.VOL_NO = B.VOL_NO)  
   LEFT OUTER JOIN SW_ORG_CODE C
   ON  (A.ORG_CODE = C.ORG_CODE) 
   LEFT OUTER JOIN SW_UNIT EE
   ON  (A.UNIT_CODE = EE.UNIT_CODE) 
   



