I am working on a report in SQL Server but cant seem to get it right. How can I return the a unique JNJobID's most recent JNNote joined to my Jobs table?
Select
JobNotesID
,JNJobID
,JNDate
,JNNote
From [JobNotes] Left JOIN Jobs ON [JobNotes].JNJobID = Jobs.JobID
Jobs Table
JobID ProjectNum
6972 PN1
6973 PN2
6974 PN3
JobNotes Table
JobNotesID JNJobID JNDate JNNote
11800 6972 2016-03-15 00:00:00.000 Example 1
11874 6972 2016-03-17 00:00:00.000 Example 2
12181 6972 2016-03-25 00:00:00.000 Example 3
12006 6973 2016-03-21 00:00:00.000 Example 4
11961 6974 2016-03-18 00:00:00.000 Example 5
11924 6974 2016-03-17 00:00:00.000 Example 6
Would return
JobID ProjectNum JNNote
6972 PN1 Example 3
6973 PN2 Example 4
6974 PN3 Example 6