What's wrong with this syntax?

From: Raymond Chui <raymond(dot)chui(at)noaa(dot)gov>
To: pgsql-general(at)postgresql(dot)org(dot)pgsql-sql(at)postgresql(dot)org
Subject: What's wrong with this syntax?
Date: 2001-07-23 14:00:46
Message-ID: 3B5C2E0E.15F32C2C@noaa.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql


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 Content-Type Size
raymond.chui.vcf text/x-vcard 414 bytes

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lee Harr 2001-07-23 14:19:12 pqReadData() -- backend closed the channel unexpectedly.
Previous Message Marcelo Pereira 2001-07-23 13:15:08 Re: Language C - Console-based FrontEnd

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2001-07-23 14:18:27 Re: Possible problems with cyclic references
Previous Message Morgan Curley 2001-07-23 13:40:46 Procedures in views