Re: ORDER BY - Mailing list pgsql-general

From Ashley Moran
Subject Re: ORDER BY
Date
Msg-id 77D769D2-0BB1-479B-AE58-D0C6B9E6ABE7@ashleymoran.me.uk
Whole thread Raw
In response to ORDER BY  ("MicroUser" <a.shafar@gmail.com>)
List pgsql-general
On Nov 14, 2006, at 10:03 pm, MicroUser wrote:

> Hi.
>
> I have a table:
>
> ID | Name
> 0 | Anna
> 1 | Other
> 2 | Link
> 3 | Fernando
>
> I need sorted result but the way like this:
>
> 0 | Anna
> 3 | Fernando
> 2 | Link
> 1 | Other
>
> Record '1 | Other' must by at the end of query result.
>
> How I can get it?
>
> Thx.
>


I suppose a nasty way would be with something like
   ORDER BY CASE "Name" WHEN 'Other' THEN 'zzzzzzzzz' ELSE "Name" END

But this might work well enough if you've only got a few rows in the
table

Ashley

pgsql-general by date:

Previous
From: Dan Armbrust
Date:
Subject: Data conversion tools?
Next
From: Joseph Shraibman
Date:
Subject: How to crash postgres using savepoints