Query to show only last entry

kroenc17

Registered User.
Local time
Today, 08:48
Joined
Sep 22, 2010
Messages
31
Pretty simple question:

I have a report that shows status entries from the last 7 days. The idea when this was made is that it SHOULD show 1 entry per project assuming the employee entered the status on the right day. Which doesn't always happen. So I want to change the report to show the last status entered for a specific project - regardless of the date. Attached are some pictures of the query that generates the report. As you can see, most of the data is from one table, and only one field has a condition on it. Not sure which field would be the best to filter to show only the most recent entry. Each status entry has it's own unique ID.

in short:
I need to change a query
from: show entry from last 7 days
to: show only the most recent entry per project

Thanks!
 

Attachments

  • 1.jpg
    1.jpg
    93.2 KB · Views: 157
  • 2.jpg
    2.jpg
    89.5 KB · Views: 146
Those nice screen shots don't help me much because I don't know how to use the GUI. I can write a little SQL, though. Maybe I can get you started (I'm not going to bother name all the columns, though)

SELECT W.ProjectName, W.EnteredBy, W.EntryDate, W.WeeklyStatus, P.ProjectManager
FROM ((WeeklyStatusCall as W
INNER JOIN
(
SELECT Max(EntryDate) as RecentDate, ProjectName
FROM WeeklyStatusCall
GROUP BY ProjectName
) as MostRecentDates
ON MostRecentDates.RecentDate = W.EntryDate
AND MostRecentDates.ProjectName = W.ProjectName)
INNER JOIN Projects as P ON P.ProjectID = W.ProjectName)
 

Users who are viewing this thread

Back
Top Bottom