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

getting previous max date from today

Status
Not open for further replies.

sexydog

Programmer
Jul 9, 2002
176
GB
hi

I have a table which stores values of bank notes per currency per day. I need to write a query that gets a value of a note per cuurency for the previous recorded date. if today is 2003/06/05 and the last recorded date was 2003/05/30 then it must return values for that date.if there were other dates like 2003/05/29,2003/05/28 it must not return it because 2003/05/30 was the lastest one from those.

Thanks
 
Try:

SELECT MAX(currencydate)
FROM currencytable
WHERE currencydate < getdate()

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top