Re: Order By - Conditional

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 09/15/04


Date: Wed, 15 Sep 2004 21:01:40 +0200

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)


Relevant Pages

  • RE: update not working
    ... Could you post ddl and sample data to reproduce the problem? ... >> Are you getting any error message? ...
    (microsoft.public.sqlserver.programming)
  • Re: Order By - Conditional
    ... My apologies Hugo, ... I must reproduce your situation on my system. ... The output you expect from the sample data you posted; ... >are getting from it - if it's an error message, ...
    (microsoft.public.sqlserver.mseq)
  • RE: update not working
    ... >> Are you getting any error message? ... >> Could you post ddl and sample data to reproduce the error? ... >> AMB ...
    (microsoft.public.sqlserver.programming)
  • Re: How to synch up values from multiple tables into a single row
    ... The expected output, based on the sample data provided. ... any SQL code you are already using, ... getting from it (if it's an error message: ...
    (microsoft.public.sqlserver.programming)
  • Re: Get Connected Crashes Computer
    ... Susan, have you solved your problem, in that case, what did you do? ... "Peter B" wrote in message ... Unfortunately I cannot reproduce the problem on ... >>>that error message is very useful. ...
    (microsoft.public.pocketpc.activesync)