jrcol12357
Programmer
I keep getting returns from TLE ??? I also tried NOT IN
WHERE
M.MTG_SK_SEQ = MP.MTG_SK_SEQ
AND M.LENDER_SK_SEQ = L.LENDER_SK_SEQ
AND M.LENDER_SK_SEQ = L2.LENDER_SK_SEQ
AND L.LENDER_SK_SEQ =LO.LENDER_SK_SEQ
AND LO.LENDER_SK_SEQ = LA.LENDER_SK_SEQ
AND L.EXP_DATE IS NULL
AND LA.EXP_DATE IS NULL
AND M.RETAIL_WHLSALE_TYPE = 'C'
AND L.RETAIL_WHLSALE_TYPE = 'C'
AND M.MTG_SK_SEQ = F.MTG_SK_SEQ
AND M.MTG_SK_SEQ = MC.MTG_SK_SEQ
AND MC.CLOSE_NAME_TYPE IN ('FLAG','LEND')
AND F.FUNDING_TYPE IN ('CWHS', 'CORR')
AND L.LENDER_ID = TLE.SELLER_ID (+) -- If lender_id in TLE do not return---
AND TRUNC(SF_GET_MAX_FUNDED_DATE(M.MTG_SK_SEQ)) >= TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE,-2)) + 1)
AND TRUNC(SF_GET_MAX_FUNDED_DATE(M.MTG_SK_SEQ)) <= TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE,-1)))
AND LO.LENDER_OFF_SEQ_NUM = (SELECT MIN(LO2.LENDER_OFF_SEQ_NUM)
FROM LENDER_OFFICER LO2
WHERE LO2.LENDER_SK_SEQ = LO.LENDER_SK_SEQ
)
WHERE
M.MTG_SK_SEQ = MP.MTG_SK_SEQ
AND M.LENDER_SK_SEQ = L.LENDER_SK_SEQ
AND M.LENDER_SK_SEQ = L2.LENDER_SK_SEQ
AND L.LENDER_SK_SEQ =LO.LENDER_SK_SEQ
AND LO.LENDER_SK_SEQ = LA.LENDER_SK_SEQ
AND L.EXP_DATE IS NULL
AND LA.EXP_DATE IS NULL
AND M.RETAIL_WHLSALE_TYPE = 'C'
AND L.RETAIL_WHLSALE_TYPE = 'C'
AND M.MTG_SK_SEQ = F.MTG_SK_SEQ
AND M.MTG_SK_SEQ = MC.MTG_SK_SEQ
AND MC.CLOSE_NAME_TYPE IN ('FLAG','LEND')
AND F.FUNDING_TYPE IN ('CWHS', 'CORR')
AND L.LENDER_ID = TLE.SELLER_ID (+) -- If lender_id in TLE do not return---
AND TRUNC(SF_GET_MAX_FUNDED_DATE(M.MTG_SK_SEQ)) >= TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE,-2)) + 1)
AND TRUNC(SF_GET_MAX_FUNDED_DATE(M.MTG_SK_SEQ)) <= TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE,-1)))
AND LO.LENDER_OFF_SEQ_NUM = (SELECT MIN(LO2.LENDER_OFF_SEQ_NUM)
FROM LENDER_OFFICER LO2
WHERE LO2.LENDER_SK_SEQ = LO.LENDER_SK_SEQ
)