Max Date Value per Name ID

G

Guest

In researching my question, I found the following statement that works for
me. I am trying to obtain, per person, the latest record. One question: I
need to use two date fields as Max...a Notes field (short date) and the
Create date (date/time). In the table, it's possible to have the same Notes
date but different create date. How would I add this to the statement below?

Statement that I found on this forum:

If you want to select the latest record for each person:

SELECT table.*
FROM table
WHERE table.datefield = (
SELECT Max(X.datefield)
FROM table As X
WHERE X.personid = table.personid)

--
 
G

Guest

This works on my data --
SELECT [change requests].*
FROM [change requests]
WHERE IIF([change requests].[date open] > [change requests].[date close],
[change requests].[date open], [change requests].[date close])=
(SELECT iif(Max(XX.[date open]) > Max(XX.[date close]), Max(XX.[date open]),
Max(XX.[date close]))
FROM [change requests] As XX
WHERE XX.Y = [change requests].Y)
 

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