SQL Order By Two Cases

If I have three columns in my dataset (price, quantity, date).  How do I allow the user to sort the data based on any and all three columns?  For example:

Order by:
price -> DESC
price -> DESC, quantity->DESC
quantity-> DESC
date -> DESC
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SharathData EngineerCommented:
Provide more information. Do you want to generate the query based on user sort option or do you want to sort the data in UI?
Latitude34Author Commented:
I need to implement paging so I'm thinking that I'll sort the data upon querying it from the DB.

The record set is going to be quite large so if there's a better way, I'm open to it.
Latitude34Author Commented:
Unless there is a more efficient way, I think I got it. Thanks.

WHEN @price = '1' THEN p END DESC,
WHEN @quantity= '1' THEN q END DESC,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anthony PerkinsCommented:
Unless there is a more efficient way, I think I got it.
That should be fine provided price has the same data type as quantity.  Date of course is quite another story and will require some additional work, but I suspect you have already figured that out.
Latitude34Author Commented:
I figured it out.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.