Обсуждение: processing results from INTERSECT, UNION or EXCEPT

Поиск
Список
Период
Сортировка

processing results from INTERSECT, UNION or EXCEPT

От
"Jody Weissmann"
Дата:
I'd like to do something as follows

SELECT t1.id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t2 INTERSECT
SELECT t3.id FROM t3)

i.e. use results from a set-operation.
If i do this in psql, i get an error message

ERROR: parser: parse error at or near "intersect"

Is there any way to do this besides using a temporary table?

Thanx,
  Jody


Re: processing results from INTERSECT, UNION or EXCEPT

От
Tom Lane
Дата:
"Jody Weissmann" <jody@ifi.unizh.ch> writes:
> SELECT t1.id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t2 INTERSECT
> SELECT t3.id FROM t3)

7.0.* doesn't support UNION/INTERSECT/EXCEPT in sub-selects.

> Is there any way to do this besides using a temporary table?

Use 7.1 ... now in beta ...

            regards, tom lane