Order by
Case when key = 'a' then 1
When key='b' then 4
When key='c' then 2
When key='d' then 3
Else 5

-----Original Message-----
From: java400-l-bounces+jehimes=liberty.edu@xxxxxxxxxxxx
[mailto:java400-l-bounces+jehimes=liberty.edu@xxxxxxxxxxxx] On Behalf Of
Ashish Kulkarni
Sent: Monday, July 30, 2007 11:12 AM
To: java400-l@xxxxxxxxxxxx
Subject: SQL and Order By Question

I have a table, which i want to sort by value in Key, for example the
table is as below
Key Desc
a This is A
b This is B
c This is C
d This is d

I want to read the result set as


How do i write this SQl statement, if i just do order by Key i can get
it either a,b,c,d or d,c,b,a but not the way i want Any ideas



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.