What's wrong with this syntax?

Поиск
Список
Период
Сортировка
От Raymond Chui
Тема What's wrong with this syntax?
Дата
Msg-id 3B5C2E0E.15F32C2C@noaa.gov
обсуждение исходный текст
Список pgsql-general
SELECT id_1 FROM table1 WHERE state_code IN ('AZ','DE')
UNION
SELECT id_1 FROM table1 WHERE zip_code IN ('12345','54321');

Above SQL statement running fine.
Now I added

SELECT id_2 FROM table2 WHERE id_1 IN (
SELECT id_1 FROM table1 WHERE state_code IN ('AZ','DE')
UNION
SELECT id_1 FROM table1 WHERE zip_code IN ('12345','54321')
);

Now I got parse error at or near "union"
Please tell me what's wrong with the 2nd SQL statement.
Thank you!


--Raymond


Вложения

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

Предыдущее
От: "Scott W. Hill"
Дата:
Сообщение: Re: psql on red hat 7.1
Следующее
От: Sam Staton
Дата:
Сообщение: Re: What CASE tools and clients for Postgres?