This thread (thread701-957119) came very close to answering my question, however, when I alter my query as directed, it only returns one record....
I need to return the earliest maintenance record from the database for each "section" ( a street section - if it matters...) Each street section has multiple maintenance records associated with it and I'm after the earliest. My original query would return all records (5,853). Here's a copy of the original query:
The query that just returns one record (albiet the earliest record in the entire database) is:
I'd appreciate any help that people can offer!!
I need to return the earliest maintenance record from the database for each "section" ( a street section - if it matters...) Each street section has multiple maintenance records associated with it and I'm after the earliest. My original query would return all records (5,853). Here's a copy of the original query:
Code:
SELECT Branch.Name, Section.SectionID, Min([Work Tracking].DATE) AS MinOfDATE, Section.Comments, Section.[_SUNIQUEID]
FROM Branch INNER JOIN (([Section] INNER JOIN _Section ON Section.[_SUNIQUEID] = [_Section].[_SUNIQUEID]) INNER JOIN [Work Tracking] ON Section.[_SUNIQUEID] = [Work Tracking].[_SUNIQUEID]) ON Branch.[_BUNIQUEID] = Section.[_BUNIQUEID]
GROUP BY Branch.Name, Section.SectionID, Section.Comments, Section.[_SUNIQUEID]
ORDER BY Branch.Name, Section.SectionID;
The query that just returns one record (albiet the earliest record in the entire database) is:
Code:
SELECT Branch.Name, Section.SectionID, [Work Tracking].DATE, Section.Comments, Section.[_SUNIQUEID]
FROM Branch INNER JOIN ([Section] INNER JOIN [Work Tracking] ON Section.[_SUNIQUEID] = [Work Tracking].[_SUNIQUEID]) ON Branch.[_BUNIQUEID] = Section.[_BUNIQUEID]
WHERE ((([Work Tracking].DATE)=(SELECT Min([Work Tracking].DATE) FROM [Work Tracking])));
I'd appreciate any help that people can offer!!