SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id

SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id

Post by Christophe Boyaniq » Sun, 12 Nov 2000 01:56:46



Tom Lane wrote :

Quote:> Current releases don't handle UNION in sub-selects.  7.1 will.

Thanks very much for this "fast as speed light" answer !

Is there an idea about the 7.1 release date ? Just to know if this is
will be in weeks, months or years...

Christophe.

 
 
 

1. SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id FROM t3)

Hello,

I've got a problem with UNION and SELECT IN

I have a first table:

CREATE TABLE products
(
  idProduct   INT4,
  name        VARCHAR(32)
);

and two others tables:

CREATE TABLE orders
(
  id          INT4,
  ts          TIMESTAMP
);

CREATE TABLE preorders
(
  id          INT4,
  ts          TIMESTAMP
);

(I reduced the tables to be as simple as possible)

I want to retrieve id of products from the tables orders and preorders;
and order it by the name of the product. So I tried:

SELECT idProduct FROM products
  WHERE idProduct IN
    (SELECT id FROM orders WHERE ts>'2000-10-01 17:04:00'
    UNION SELECT id FROM preorders WHERE ts>'2000-10-01 17:04:00')
  ORDER by name;

and I've got a parse error near UNION or SELECT depending of the
presence
of () between the SELECTs.

I definitively need some help to solve this problem :-|

I asked to a friend to test it with Oracle and that seems to work so I
really don't know what to do...

Christophe.

2. How to launch and kill an external application from within a C program

3. blocked database by the server

4. Help select. . .where id in :id

5. WebServer2

6. process ID to Node ID:Processor ID mapping

7. error message, possible bug?

8. Help select. . .where id

9. Siemens Gigaset 2420 & Caller-ID and Call waiting ID from BellSouth in Atlanta

10. Renaming numeric Id variable into character Id var with common prefix

11. Renaming numeric Id variable into character Id var withcommonprefix

12. transforming multiple records per id to one record per id