[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to ORDER BY after comparing two fields

Posted on 2012-04-09
2
Medium Priority
?
231 Views
Last Modified: 2012-04-10
Hello

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
0
Comment
Question by:tncode
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 37824088
ORDER BY cars.driven is null desc,
case when tester.testdriver = manager.driver  then 1 else 2 end,
tester.testdriver desc
0
 
LVL 6

Author Closing Comment

by:tncode
ID: 37827489
Thanks!!!
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question