I have got the following table in which we store project plans:
ID PROJECT_NAME MILESTONE_NAME
All milestones start with a number such as “0.1 – Milestone Description”.
I would like to retrieve the MAX MILESTONE_NAME ordered by project.
I used the following code but it doesn’t work…
SELECT Sheet1.[PROJECT_NAME], MAX(Sheet1.[MILESTONE_NAME])
FROM Sheet1 INNER JOIN Sheet1 AS Sheet1_1 ON (Sheet1.[PROJECT_NAME] = Sheet1_1.[PROJECT_NAME]) AND (Sheet1.[MILESTONE_NAME] = Sheet1_1.[MILESTONE_NAME])
ORDER BY Sheet1.[PROJECT_NAME]
It says the PROJECT_NAME is out of the aggregated function.
Do you guys have any idea how I should move forward?
Thanks!
You have to
GROUP BY Sheet1.[PROJECT_NAME].Try :