jeffreybrown
Well-known Member
- Joined
- Jul 28, 2004
- Messages
- 5,152
I have a query where I need to flag if a Projects.ID has been duplicated due to a Notes.Notes field being added to the query.
The sql above works fine to show the max date in the Notes.ChangedDate field; however, as soon as the field Notes, the query expands to show all notes as they are unique.
How can I add a field to the query which would annotate the Projects.ID field with a count like we would in Excel with countif?
In this field though, I would like the max date of the Notes.ChangedDate field to be the one and then any other duplicated records as 2, 3, 4, etc.
I could then filter the new field by 1 and get all the Projects.ID and their associated notes.
Code:
SELECT Projects.ID, Max(Notes.ChangedDate) AS MaxOfChangedDate
FROM Notes RIGHT JOIN Projects ON Notes.PID = Projects.ID
WHERE (((Projects.ProjStatus)="In Progress"))
GROUP BY Projects.ID;
The sql above works fine to show the max date in the Notes.ChangedDate field; however, as soon as the field Notes, the query expands to show all notes as they are unique.
How can I add a field to the query which would annotate the Projects.ID field with a count like we would in Excel with countif?
In this field though, I would like the max date of the Notes.ChangedDate field to be the one and then any other duplicated records as 2, 3, 4, etc.
I could then filter the new field by 1 and get all the Projects.ID and their associated notes.
Last edited: