SELECT A.LS_KEY , A.AMND_NBR , A.ASSET_SEQ_NBR , A.PROPERTY_ID , A.BUSINESS_UNIT_AM , A.LS_MAP_ID , A.RATE_MULT , A.RATE_DIV , A.CF_SEQNO , SUM(A.AMOUNT_ALLOC_GUAR) FROM PS_RE_LSA_PPTY A WHERE A.AMND_NBR = ( SELECT MAX(X.AMND_NBR) FROM PS_RE_LSA_PPTY X WHERE A.BUSINESS_UNIT_AM = X.BUSINESS_UNIT_AM AND A.ASSET_ID = X.ASSET_ID ) GROUP BY LS_KEY , A.AMND_NBR , A.ASSET_SEQ_NBR , A.PROPERTY_ID , A.BUSINESS_UNIT_AM , A.LS_MAP_ID , A.RATE_MULT , A.RATE_DIV , A.CF_SEQNO UNION SELECT A.LS_KEY , A.AMND_NBR , A.ASSET_SEQ_NBR , A.PROPERTY_ID , A.BUSINESS_UNIT_AM , A.LS_MAP_ID , B.RATE_MULT , B.RATE_DIV , A.CF_SEQNO , SUM(A.AMOUNT_ALLOC_GUAR) FROM PS_RE_LSA_AST_DST A , PS_RE_LSA_PPTY B WHERE A.LS_KEY = B.LS_KEY AND A.AMND_NBR = B.AMND_NBR AND A.ASSET_SEQ_NBR = B.ASSET_SEQ_NBR AND A.PROPERTY_ID = B.PROPERTY_ID AND B.AMND_NBR = ( SELECT MAX(X.AMND_NBR) FROM PS_RE_LSA_PPTY X WHERE B.BUSINESS_UNIT_AM = X.BUSINESS_UNIT_AM AND B.ASSET_ID = X.ASSET_ID ) GROUP BY A.LS_KEY , A.AMND_NBR , A.ASSET_SEQ_NBR , A.PROPERTY_ID , A.BUSINESS_UNIT_AM , A.LS_MAP_ID , B.RATE_MULT , B.RATE_DIV , A.CF_SEQNO
|