Re: Order By - Conditional
From: Wes (anonymous_at_discussions.microsoft.com)
Date: 09/16/04
- Next message: anonymous_at_discussions.microsoft.com: "How to Convert Character String to Numeric- Thanks!"
- Previous message: squarepants4117: "Updating Table in SQL"
- In reply to: Hugo Kornelis: "Re: Order By - Conditional"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 16 Sep 2004 01:50:35 -0700
My apologies Hugo,
the query was correct.
When building test data to send you, I noticed that the
only problemn i had was the order of the 2 case
statements. i.e. I switched the case statements
instead of ...
>>ORDER BY CASE WHEN Status > 11 THEN Name END,
>>CASE WHEN Status <= 11 THEN Order_ID END
i used ...
>>ORDER BY CASE WHEN Status <= 11 THEN Order_ID END,
>>CASE WHEN Status > 11 THEN Name END
Thanks for you help!
Wes
>-----Original Message-----
>On Wed, 15 Sep 2004 10:14:33 -0700, Wes wrote:
>
>>I have tried the following but with no success...
>>
>>ORDER BY CASE WHEN Status > 11 THEN Name END,
>>CASE WHEN Status <= 11 THEN Order_ID END
>>
>>
>>Is there any other approach I can use?
>>
>>Thanks in advance
>
>Hi Wes,
>
>Could you be more specific? What happened when you tried
the code above?
>Did you get an error? Unexpected results? Explosions in
the server room?
>
>I don't see anything wrong with the code snippet above.
To goo further
>into this, I must reproduce your situation on my system.
To do that, you
>should post more information. To be precise, I need:
>
>1. Table structure, posted as DDL (CREATE TABLE
statements; irrelevant
>columns may be omitted but please do include all
constraints);
>2. Enough sample data to show what you want to achieve,
posted as INSERT
>statements;
>3. The output you expect from the sample data you posted;
>4. The complete SQL statement you are currently using
plus the output you
>are getting from it - if it's an error message, please
copy and paste the
>complete text;
>5. A short and concise description of the business
problem you're trying
>to solve.
>
>With that, I should be able to reproduce your problem and
search for a
>solution.
>
>Best, Hugo
>--
>
>(Remove _NO_ and _SPAM_ to get my e-mail address)
>.
>
- Next message: anonymous_at_discussions.microsoft.com: "How to Convert Character String to Numeric- Thanks!"
- Previous message: squarepants4117: "Updating Table in SQL"
- In reply to: Hugo Kornelis: "Re: Order By - Conditional"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|