Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Overchewed

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-11-07 : 09:20:23
writes "Like the subject says, we've seen it but...

Is there a way to order records by multiple columns using the CASE statement?

Like:

ORDER BY
CASE @sort
WHEN 0 THEN column1, column2
WHEN 1 THEN column2, column1
END

I keep getting "incorect sintax near ','..."

My fountain of SQL knowledge is drying up here...

Is there a oasis in sight???"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-11-07 : 09:40:23
When you fountain dries up, you should look into tapping the SEARCH reservoir ...

Dynamic ORDER BY

Jay White
{0}
Go to Top of Page
   

- Advertisement -