Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where Clause

Status
Not open for further replies.

jrcol12357

Programmer
May 9, 2007
39
US
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
)
 
This works...

AND L.LENDER_ID NOT IN (SELECT SELLER_ID
FROM TBL_RPT_10659_VIP_LENDERS TLE)
 
that plus sign is oracle syntax, and will not work in mysql

TRUNC and LAST_DAY will need to be rewritten, too

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top