pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
What's wrong with this syntax?
2+ messages / 2 participants
[nested] [flat]

* What's wrong with this syntax?
@ 2001-07-23 14:00  Raymond Chui <raymond.chui@noaa.gov>
  0 siblings, 1 reply; 2+ messages in thread

From: Raymond Chui @ 2001-07-23 14:00 UTC (permalink / raw)
  To: pgsql-general@postgresql.org.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

Attachments:

raymond.chui.vcf (text/x-vcard, 413B) download begin:vcard n:Chui;Raymond tel;fax:(301)713-0963 tel;work:(301)713-0624 Ext. 168 x-mozilla-html:TRUE url:http://members.xoom.com/rchui/ org:NWS, NOAA version:2.1 email;internet:Raymond.Chui@noaa.gov title:SA, DBA note:ICQ #: 16722494 adr;quoted-printable:;;NOAA, NWS, Office of Hydrology, OH=0D=0A1325 East-West Highway, Room 8112;Silver Spring;MD;20910-3283;U.S.A. x-mozilla-cpt:;-6384 fn:Raymond Chui end:vcard
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: [SQL] What's wrong with this syntax?
@ 2001-07-23 18:19  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Raymond Chui <raymond.chui@noaa.gov>
  0 siblings, 0 replies; 2+ messages in thread

From: Stephan Szabo @ 2001-07-23 18:19 UTC (permalink / raw)
  To: Raymond Chui <raymond.chui@noaa.gov>; +Cc: pgsql-general@postgresql.org; pgsql-sql


I don't get a parse error for the below query (made up some table
structures with those fields) on 7.2devel, what version are you
running?


On Mon, 23 Jul 2001, Raymond Chui wrote:

> 
> 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!





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-07-23 18:19 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-23 14:00 What's wrong with this syntax? Raymond Chui <raymond.chui@noaa.gov>
2001-07-23 18:19 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox