Re: total query with last date

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Jun 19, 8:59 pm, John W. Vinson
<jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
On Tue, 19 Jun 2007 17:45:20 -0700, zions...@xxxxxxxxx wrote:
I have a table with 5 fields
ID PersonID Date Amount and Type

I want a query with the last record of each person based on date and I
want the results like this

PersonID LastOfDate Amount Type

How can i do that
thanks

A Subquery will do this:

SELECT PersonID, [Date], Amount, Type
FROM tablename
WHERE [Date] =
(SELECT Max([Date]) FROM tablename AS X
WHERE X.PersonID = tablename.PersonID);

John W. Vinson [MVP]

thank you john!

.



Relevant Pages