subselect test - Mailing list pgsql-sql

From Robert B. Easter
Subject subselect test
Date
Msg-id 0101090206301S.09559@comptechnews
Whole thread Raw
List pgsql-sql
SELECT a, (SELECT b FROM y LEFT JOIN n ON b = c WHERE b = a + 1) AS b, c FROM 
(SELECT * FROM y CROSS JOIN (x NATURAL RIGHT JOIN n)) AS z NATURAL JOIN 
(SELECT * FROM x) AS zz  WHERE a NOT IN (SELECT b FROM y NATURAL JOIN x WHERE 
b > 5) GROUP BY a, b, c HAVING a IN (SELECT b FROM y LEFT JOIN x ON (a = b) 
CROSS JOIN n WHERE b > 1) INTERSECT SELECT * FROM x,y,n EXCEPT SELECT * FROM 
x,y,n WHERE a < 3 ORDER BY a DESC LIMIT 10;   
   a     |    b     |    c
----------+----------+----------5.000000 | 6.000000 | 1.0000005.000000 | 6.000000 | 2.0000005.000000 | 6.000000 |
3.0000005.000000| 6.000000 | 4.0000005.000000 | 6.000000 | 5.0000005.000000 | 6.000000 | 6.0000005.000000 | 6.000000 |
7.0000004.000000| 5.000000 | 1.0000004.000000 | 5.000000 | 2.0000004.000000 | 5.000000 | 3.000000
 
(10 rows)                  

Is this confusing?  Is the result correct?  Anyway, these new complex queries 
seem to be doing something in 7.1 cvs!

-- 
-------- Robert B. Easter  reaster@comptechnews.com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Sv: how to build this query ??? Please help !!!
Next
From: juerg.rietmann@pup.ch
Date:
Subject: how to store this record ?? pg_atoi