SELECT A.SHEET_ID , B.MAX_LINE_NBR , B.MAX_DISTRIB_LINE , ROUND( %DateDiff(A.APPROVAL_DT, E.PYMNT_DT) ,2) AS APPR_PD FROM PS_EX_SHEET_HDR A , PS_EX_SHEET_PYMNT E , PS_EX_MAX_LN_DL_VW B , PS_EX_SHEET_LINE C , PS_EX_SHEET_DIST D WHERE A.SHEET_ID = E.SHEET_ID AND A.BUSINESS_UNIT_GL = E.BUSINESS_UNIT_GL AND A.SHEET_STATUS = 'PD' AND A.SHEET_ID = B.SHEET_ID AND B.SHEET_ID = C.SHEET_ID AND C.SHEET_ID = D.SHEET_ID AND B.MAX_LINE_NBR = C.LINE_NBR AND B.MAX_LINE_NBR = D.LINE_NBR AND B.MAX_DISTRIB_LINE = D.DISTRIB_LINE_NUM
|