Simple query

T

Thomasa

I have a simple query that returns the information as
listed below:

Name Date
bob 7/1/2000
bob 7/31/2004
jim 1/1/2000
jim 1/1/2004
mark 6/3/2000
mark 6/3/2004
sue 1/1/2000
sue 1/5/2004

How can I take the above query and make it select only
the most recent date as displayed below?

Name Date
bob 7/31/2004
jim 1/1/2004
mark 6/3/2004
sue 1/5/2004

Thank you in advance.
 
L

LeAnne

Hi Thomasa,

SELECT MyName, MAX([MyDate]) AS MostRecentDate
FROM MyTable
GROUP BY MyName;

Note that it's generally not a good idea to use "Name" and "Date" as
fieldnames. These are reserved words in Access (that is, they refer to
specific functions or properties) & could give you problems later.

hth,

LeAnne
 
T

Thomasa

Thank you that worked great and thanks for the advise on
naming the fields.
-----Original Message-----
Hi Thomasa,

SELECT MyName, MAX([MyDate]) AS MostRecentDate
FROM MyTable
GROUP BY MyName;

Note that it's generally not a good idea to use "Name" and "Date" as
fieldnames. These are reserved words in Access (that is, they refer to
specific functions or properties) & could give you problems later.

hth,

LeAnne
I have a simple query that returns the information as
listed below:

Name Date
bob 7/1/2000
bob 7/31/2004
jim 1/1/2000
jim 1/1/2004
mark 6/3/2000
mark 6/3/2004
sue 1/1/2000
sue 1/5/2004

How can I take the above query and make it select only
the most recent date as displayed below?

Name Date
bob 7/31/2004
jim 1/1/2004
mark 6/3/2004
sue 1/5/2004

Thank you in advance.
.
 

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