Filter By Date

G

Guest

I have a table of notes. Notes are tied to a Project ID so any particular ID
could have several notes. I would like to do a query that would pick only the
latest note for each project number. Any help would be appreciated.
 
D

Duane Hookom

"Any help would be appreciated" regarding your table structure...
Maybe:

SELECT *
FROM tblProjectNotes
WHERE NoteID in (SELECT TOP 1 NoteID
FROM tblProjectNotes n
WHERE n.ProjectID = tblProjectNotes.ProjectID
ORDER BY NoteDate DESC, NoteID DESC);
 

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