How to ORDER BY after comparing two fields
Posted on 2012-04-09
I am trying to create a report that will produce information about the cars in our shop. In my report, I am trying to pull a report and order by all of the cars that have not been driven at all, all of the cars that have been driven initially by a test driver and the most recent driver who is a manager, and then all cars that have been driven most recent to the oldest. It is possible that the manager.driver is also the tester.testdriver. So, I want to have this ordered in my report after I see a list of all the cars that have not been driven. How to I check to see if two fields are equivalent and order them? If you need more information let me know.
In my ORDER BY, I have
ORDER BY cars.driven is null desc,tester.testdriver == manager.driver , tester.testdriver desc