I've inherited an Access database and am looking to start using it to do reporting. I've written a query that gets me the information I'm looking for, I'm just hoping someone can have a look over it and tell me if I'm doing it the wrong way or not.
Anyway, the query takes information from 3 tables:
- sites- more detailed information on each workplace
- employees- list of employees and their associated workplace
- cases- holds the bulk of the information needed for the report
I want most fields from the cases table as this is how work is tracked, but I want to also group by the city which is in the sites table and by employee name from the employees table.
SELECT 
    sites.city, 
    employees.[first name], 
    employees.[last name], 
    cases.[assigned to], 
    cases.ref, 
    cases.status, 
    cases.priority, 
    cases.[opened date], 
    Round(Now()-cases.[opened date],0) AS Age
FROM
    cases 
LEFT JOIN 
    (employees LEFT JOIN sites ON employees.site = sites.site) 
ON 
    cases.[assigned to] = employees.username
WHERE 
    cases.[assigned to]<>"Not Assigned" 
AND 
    cases.status="Active" 
AND 
    cases.priority<>"first contact"
ORDER BY 
    sites.city, 
    employees.[first name], 
    employees.[last name], 
    cases.[opened date] desc;
Is there any stupid rookie mistakes in here that I've fallen prey to? Could that be done any better? Have I not given enough information in my question?


