Re: Alias "all fields"?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Alias "all fields"?
Date: 2007-09-06 12:23:11
Message-ID: 46DFF12F.9020907@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stefan Schwarzer wrote:
> SELECT * FROM gdp WHERE y1970 NOT NULL AND y1971 NOT NULL AND
> .... y2005 NOT NULL
>
> I would like to have this:
>
> SELECT * FROM gdp WHERE all-fields NOT NULL

Well you can get closer:

SELECT * FROM gdp WHERE (y1970+y1971+...+y2005) IS NOT NULL;

This makes use of the fact that X+NULL = NULL

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2007-09-06 12:46:04 Re: Alias "all fields"?
Previous Message hubert depesz lubaczewski 2007-09-06 12:16:21 Re: Need suggestion on how best to update 3 million rows