Re: Replace NULL values

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Replace NULL values
Date: 2006-09-07 10:11:19
Message-ID: 20060907101119.GE10093@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 07, 2006 at 11:54:43AM +0200, Stefan Schwarzer wrote:
> As I said, I couldn't figure out how COALESCE would work on multiple
> columns (without naming them explicitly).
>
> So, say I have a table with columns for each year between 1970 and
> 2005. For specific countries the values might be NULL, depending if
> the statistical table has been updated recently (then they will have
> a value), or not (then they will be NULL). A sample query would thus
> be something like:
>
> SELECT * FROM pop_density

Ah, your data is denormalised. SQL doesn't handle that kind of data
very well at all. A user-defined function should be able to handle that
though (not pl/pgsql).

Hope this helps,

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Valentin Militaru 2006-09-07 10:27:59 Help using user rights
Previous Message Stefan Schwarzer 2006-09-07 09:54:43 Re: Replace NULL values