By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Access SQL: List unique records with max date.

P: 1
I have a table like this:
[html]
|==============================================|
|Type |Name |Weight | Date of weighing |
|==============================================|
|Children | Gablu | 22 | 4/4/2007
|----------------------------------------------|
|Children | Gablu | 26 | 5/8/2007
|----------------------------------------------|
|Adult | Gablu | 20 | 1/3/2007
|----------------------------------------------|
|Children | Sumo | 18 | 7/8/2007
|----------------------------------------------|
|Adult | Sumo | 30 | 9/10/2007
|----------------------------------------------|
|Children | Sumo | 27 | 9/10/2007
|----------------------------------------------|
[/html]
NOW, I wan to write a query that will be something like this.

SELECT Name, Weight
FROM MYTABLE
WHERE TYPE=Children AND DateOfWeighing=Max(DateofWeighing)

This should return two distinct records (i.e Second and Last one) with latest date for a Child->Name

Can anyone help.

With regards.
Sep 20 '07 #1
Share this Question
Share on Google+
1 Reply


Scott Price
Expert 100+
P: 1,384
So what happens when you try to execute the query that you wrote above?

Regards,
Scott
Sep 21 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.