Re: help with query: advanced ORDER BY... - Mailing list pgsql-novice

From
Subject Re: help with query: advanced ORDER BY...
Date
Msg-id 011601c61949$9660a160$6402a8c0@iwing
Whole thread Raw
In response to help with query: advanced ORDER BY...  (<me@alternize.com>)
Responses Re: help with query: advanced ORDER BY...  (Michael Fuhr <mike@fuhr.org>)
List pgsql-novice
> Something like this might work:
>
> SELECT * FROM table1
> ORDER BY field1,
>         CASE WHEN field1 THEN field2 ELSE NULL END,
>         CASE WHEN field1 THEN field3 ELSE NULL END,
>         CASE WHEN field1 THEN NULL ELSE field3 END,
>         CASE WHEN field1 THEN NULL ELSE field2 END;


it indeed does, thanks alot. will pgsql still use the indices when ordering
through CASE?

cheers,
thomas



pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: help with query: advanced ORDER BY...
Next
From: Michael Fuhr
Date:
Subject: Re: help with query: advanced ORDER BY...