Re: [SQL] What's wrong with this syntax?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Raymond Chui <raymond(dot)chui(at)noaa(dot)gov>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] What's wrong with this syntax?
Date: 2001-07-23 18:19:23
Message-ID: Pine.BSF.4.21.0107231116120.55137-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-07-23 19:02:13 Re: pqReadData() -- backend closed the channel unexpectedly.
Previous Message Philip Hallstrom 2001-07-23 18:13:27 Re: PASSWORD() function for postgresql?

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2001-07-23 18:36:54 RE: position(text,text) function
Previous Message omid omoomi 2001-07-23 18:09:13 Re: position(text,text) function