From: | Ashley Moran <work(at)ashleymoran(dot)me(dot)uk> |
---|---|
To: | "MicroUser" <a(dot)shafar(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: ORDER BY |
Date: | 2006-11-15 19:50:39 |
Message-ID: | 77D769D2-0BB1-479B-AE58-D0C6B9E6ABE7@ashleymoran.me.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Joseph Shraibman | 2006-11-15 19:57:54 | How to crash postgres using savepoints |
Previous Message | Ron Johnson | 2006-11-15 19:41:47 | Re: Using SAN Splits to instantly copy a DB |