Re: Sorting by NULL values

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Ian Burrell <ib(at)onsitetech(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Sorting by NULL values
Date: 2003-03-04 19:01:52
Message-ID: 200303041101.52565.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ian,

> I am doing a query where I need to sort by a column that may be NULL
> because it is coming from an OUTER JOIN. I noticed a difference between
> PostgreSQL and other databases about where NULLs show up. It seems that
> with Postgres, NULLs are sorted after other values. Other databases
> sort them before.

Not all other databases. It really depends.

> Is there a way to replace the NULLs with
> empty strings?

Sure: UPDATE table SET column = '' WHERE column IS NULL

--
Josh Berkus
josh(at)agliodbs(dot)com
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2003-03-04 19:39:32 Re: Convert a text list to text array? Was: Denormalizing during
Previous Message Guy Fraser 2003-03-04 18:40:17 Re: Gist indexes on int arrays