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@magproductions.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 //