retrieving most recent date using SQL

G

Guest

Hi,

I wanted to use a select statement to retrieve only the most recent date
from a date formated column. The table I am using contains a large number of
date and payment records along with customer ID's. I want to generate a query
that selects customers most recent payment - the date of the payment and the
amount.

thanks,

Pedro
 
D

Dave Patrick

Try something like;

Select TOP 1 table1.[paymentdate], table1.[paymentamount]
FROM table1
Where (((table1.[customerID])='someID'))
ORDER BY table1.[paymentdate] DESC;

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top