Ordering Results
- From: Wes <Wes@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 24 Aug 2005 04:41:03 -0700
Hi,
I have a result set that returns Loctation Codes.
Each location code is the following format: [Letter][2 Digit Number].
For example,
A10
B13
D04
What I would like to do is if the letter is either A, C, E, G then order the
results by the letter, then by the 2 digit numbers in ascending order.
If the letter is either B, D, F, H then order the results by the letter,
then by the 2 digit numbers in descending order.
So if A, C, E etc then numbers are ascending.
If B, D, F etc then numbers are descending.
A result set could look as follows
A01
A02
A03
A05
B30
B28
B27
B05
C03
C04
C07
D15
D12
D11
If I could use a case statement within the order by clause, it would solve
my problem, but I get an error when attempting to write a case statement
within the ORDER BY clause.
Thanks in advance,
Wes.
.
- Follow-Ups:
- Re: Ordering Results
- From: Steve Kass
- Re: Ordering Results
- Prev by Date: Where and Union Clauses
- Next by Date: Re: Ordering Results
- Previous by thread: Where and Union Clauses
- Next by thread: Re: Ordering Results
- Index(es):
Relevant Pages
|
|