What's wrong with this syntax? - Mailing list pgsql-general

From Raymond Chui
Subject What's wrong with this syntax?
Date
Msg-id 3B5C2E0E.15F32C2C@noaa.gov
Whole thread Raw
List 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


Attachment

pgsql-general by date:

Previous
From: "Scott W. Hill"
Date:
Subject: Re: psql on red hat 7.1
Next
From: Sam Staton
Date:
Subject: Re: What CASE tools and clients for Postgres?