how to get the last date

G

Guest

There is a table called Events with two fields EventsID and HeldDate, now I
want to make a query to give me a list with two columes, EventsID and
LastHeldDate.

That is, if I have the following data:

EventID HeldDate
1 01/01/05
2 05/01/05
1 15/01/05
2 02/02/05


The query should give me:

EventID LastHeldDate
1 15/01/05
2 02/02/05


Any help will be highly appreciated.
 
M

Marshall Barton

Minnow said:
There is a table called Events with two fields EventsID and HeldDate, now I
want to make a query to give me a list with two columes, EventsID and
LastHeldDate.

That is, if I have the following data:

EventID HeldDate
1 01/01/05
2 05/01/05
1 15/01/05
2 02/02/05


The query should give me:

EventID LastHeldDate
1 15/01/05
2 02/02/05


SELECT EventID, Max(HeldDate) As Latest
FROM Events
GROUP BY EventID
 

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