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