Re: [SQL] Howto to force NULL rows at the bottom ?

From: Stoyan Genov <genov(at)digsys(dot)bg>
To: Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Howto to force NULL rows at the bottom ?
Date: 1999-12-05 11:53:48
Message-ID: 199912051153.NAA24720@lorna.digsys.bg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

If you bother about the NULLs positioned at the bottom of the selection,
and not how
non-NULL data is ordered, you can just use ORDER BY field DESC - this will
position
NULLs at the bottom, ordering non-NULL data from the highest values to the
lowest.

Regards,
Stoyan Genov

> Hi,
>
> how can I force NULL rows at the bottom of the result list in an
> ordered SELECT?
>
> with ORDER BY I get
>
> NULL
> Peter
> Jane
>
> but I want
>
> Peter
> Jane
> NULL
>
> --
> Dirk
>
> ************
>

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jonathan Karlen 1999-12-05 15:39:39 Accent Marks
Previous Message Tom Lane 1999-12-05 05:47:00 Re: [SQL] group by