I'm try to count a number of orders sorted by the driver who completed the order. (SQL 2000)
The basic Query works fine.
SELECT d.driver, COUNT(*) filesserved FROM orders d WHERE (deleted = 0) AND (CAST(datepost AS DATETIME) <= '" & strEndDate & "') GROUP BY driver WITH CUBE ORDER BY driver
I would like however to have the results appear alphabetical, in that driver in orders is stored as a driver identification number, so right now, the output comes out by order of the driver id's.
I've been trying to incorporate a join that looks up the last name, first name, and have it order by the last name then first name, instead of by the driver's code, but can't seem to make it work.
I add a JOIN driverdata e ON d.driver = e.driverid after the FROM, and then have tried to add an e.last_name, e.first_name to the query, replacing driver in the group by, and order sections, but consistently get errors. Anyone out there got any suggestions?