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 2005 Forums
 Express Edition and Compact Edition (2005)
 SORTING ORDER BY - WORD

Author  Topic 

programer
Posting Yak Master

221 Posts

Posted - 2010-08-21 : 05:34:40
Is it possible with SQL sorted in descending order according to the word?
In Table I shrajeno Mastercard, Visa, Diners etc ...

All Visa are the first in the order, another Mastercard, etc. ...

Something does not work: ORDER BY PaymentType = 'Visa';

I would not want to work in one field PaymentId (111,222,33, etc. ..) and then use the ORDER BY.

Is this possible in such a way?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-08-21 : 08:52:10
[code]order by case PaymentType when 'Visa' then 1 when 'Mastercard' then 2 . . . . .end[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-21 : 13:30:57
if you've lot of items which needs to be order in customised way better to store order value also in mapping table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -