From: | Alban Hertroys <alban(at)magproductions(dot)nl> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>, pgsql-general(at)postgresql(dot)org |
Subject: | ANY (was: Re: Alias "all fields"?) |
Date: | 2007-09-06 12:51:51 |
Message-ID: | 46DFF7E7.7030908@magproductions.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Richard Huxton wrote:
> 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
I was going to suggest
SELECT * FROM gdp WHERE NULL NOT IN (y1970, y1971, y1972);
But that doesn't work.
So I tried using ANY with IS NOT NULL, as according to the documentation
"IN is equivalent to = ANY"
(
http://www.postgresql.org/docs/8.2/static/functions-subquery.html#AEN13967)
So maybe:
SELECT * FROM gdp WHERE NULL IS NOT ANY(y1970, y1971, y1972);
I get nothing but syntax errors... I remember trying to use ANY in the
past and never got it to work...
So, how do you use ANY with a fixed set of values (the way IN can)? And
can this be used to solve the OP's problem without using tricks like
summing NULL values?
--
Alban Hertroys
alban(at)magproductions(dot)nl
magproductions b.v.
T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede
// Integrate Your World //
From | Date | Subject | |
---|---|---|---|
Next Message | Tino Wildenhain | 2007-09-06 12:51:54 | Re: Alias "all fields"? |
Previous Message | Franz.Rasper | 2007-09-06 12:46:26 | Re: Alias "all fields"? |