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!

query to get records in one table but not in another one.

Status
Not open for further replies.

cb49747

MIS
Apr 23, 2002
181
US
Hello,

I have this query that works but now I want to refine it so that it only selects records in the loaninfo table that do not have a record in the achtransfer table. I not sure how to do that. Here is the query I have now.

Code:
SELECT loaninfo.loannumber, loaninfo.investornumber, loaninfo.nextduedate, loaninfo.lastpaymentdate, achtransfer.paymentdate, achtransfer.total_amount 
          FROM loaninfo LEFT JOIN achtransfer ON loaninfo.loannumber=achtransfer.loannumber
          WHERE loaninfo.totaldelinquent > '0' AND loaninfo.upb > '0'

Any help greatly appreciated.
 
Code:
SELECT loaninfo.loannumber
     , loaninfo.investornumber
     , loaninfo.nextduedate
     , loaninfo.lastpaymentdate
  FROM loaninfo 
LEFT 
  JOIN achtransfer 
    ON achtransfer.loannumber 
     = loaninfo.loannumber
 WHERE [b]achtransfer.loannumber is null[/b]
   and loaninfo.totaldelinquent > 0 
   AND loaninfo.upb > 0
i removed the achtransfer columns from the SELECT (since they're going to be NULL anyway), and i removed the quotes from the numeric constants

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

Part and Inventory Search

Sponsor

Back
Top