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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding the last record

Status
Not open for further replies.

fcl22

Technical User
Apr 16, 2003
14
US
I want to see everbody that paid after 12/31/2001 I get everbody that paid for 2002 and 2003 thus creating duplicates. How can I get the last payment for either 2002 or 2003
 
select * from tablename where datepaid >'12/31/2001 ' And datepaid <'1/1/2002 ' UNION select * from tablename where datepaid =>'1/1/2002' And datepaid <'1/1/2003 '

 
Code:
select * from t q
where dateColumn = (select max(dateColumn) from t
where dateColumn > '12/31/2001'
  and memberId = q.memberId)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top