intersect within a subquery

Поиск
Список
Период
Сортировка
От Phil Glatz
Тема intersect within a subquery
Дата
Msg-id 5.1.0.14.2.20011121131859.031a86a8@flawless.net
обсуждение исходный текст
Ответы Re: intersect within a subquery  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I have a table cdb, indexed by cdb_id.
A second table map_flags to map to some other data.  It has a cdb_id field,
used to link to cdb.

I want to select a subset of cdb where records with a specific cdb_id is
present in two rows in map_flags, so I created a subquery to pull the
records from map_flags, using INTERSECT.  This query runs by itself ok, but
when I use it as a subquery, I get parse error at or near "intersect".

Isn't this legal?

SELECT c.cdb_id,c.company
FROM cdb c
WHERE c.cdb_id IN
   (SELECT m.cdb_id FROM map_flags m
   WHERE m.cflag_id=240
   INTERSECT
   SELECT m.cdb_id FROM map_flags m
   WHERE m.cflag_id=30)
ORDER BY c.company;


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

Предыдущее
От: "Thomas T. Thai"
Дата:
Сообщение: Re: PG vs MySQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: intersect within a subquery