ANY (was: Re: Alias "all fields"?)

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема ANY (was: Re: Alias "all fields"?)
Дата
Msg-id 46DFF7E7.7030908@magproductions.nl
обсуждение исходный текст
Ответ на Re: Alias "all fields"?  (Richard Huxton <dev@archonet.com>)
Ответы Re: ANY  (Richard Huxton <dev@archonet.com>)
Список 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@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 //

В списке pgsql-general по дате отправления:

Предыдущее
От: Paul Tilles
Дата:
Сообщение: Version 8.2.4 ecpg - function not found
Следующее
От: Tino Wildenhain
Дата:
Сообщение: Re: Alias "all fields"?