Re: Ordering Results by a Supplied Order

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Michael Sacket <msacket(at)gammastream(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Ordering Results by a Supplied Order
Date: 2014-02-06 16:39:16
Message-ID: CAL_0b1tV16zvp7YNczL08p=Rxp99TFkb9iYCfzSSGstmHACqDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 5, 2014 at 7:16 PM, Michael Sacket <msacket(at)gammastream(dot)com> wrote:
> Often times I find it necessary to work with table rows in a specific,
> generally user-supplied order. It could be anything really that requires an
> ordering that can't come from a natural column. Most of the time this
> involved manipulating a position column from the client application. In any
> case, I've often found that to be cumbersome, but I think I've come up with
> a solution that some of you may find useful.

There also are some ways of doing it without creating an additional
column http://www.depesz.com/2010/07/25/how-to-order-by-some-random-query-defined-values/.

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

http://www.linkedin.com/in/grayhemp
+1 (415) 867-9984, +7 (901) 903-0499, +7 (988) 888-1979
gray(dot)ru(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Sacket 2014-02-06 16:43:20 Re: Ordering Results by a Supplied Order
Previous Message alexandros_e 2014-02-06 16:27:04 Re: Postgresql GROUP BY "SIMILAR" but not equal values