Re: ORDER BY - problem with NULL values

From: Tommy Gildseth <tommy(dot)gildseth(at)usit(dot)uio(dot)no>
To: Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ORDER BY - problem with NULL values
Date: 2007-10-12 12:04:53
Message-ID: 470F62E5.2020800@usit.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stefan Schwarzer wrote:
> Hi there,
>
> if I order a given year in DESCending ORDER, so that the highest
> values (of a given variable) for the countries are displayed at the
> top of the list, then actually the NULL values appear as first. Only
> below, I find the values ordered correctly.
>
> Is there any way to
>
> a) make the countries with NULL values appear at the bottom of the list

... ORDER BY y_2000 IS NULL [DESC], y_2000;

> b) neglect the NULL values by still allowing the countries to be
> displayed

Not quite sure what you mean by this.

--
Tommy Gildseth

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2007-10-12 12:54:44 Re: Coercing compound types to use generic ROW comparison operators
Previous Message Nico Sabbi 2007-10-12 11:29:11 Re: ORDER BY - problem with NULL values