From: Robert B. Easter <reaster@comptechnews.com>
To: pgsql-sql@postgresql.org
Subject: subselect test
Date: Tue, 9 Jan 2001 02:06:30 -0500
Message-ID: <0101090206301S.09559@comptechnews> (raw)
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.000000
5.000000 | 6.000000 | 2.000000
5.000000 | 6.000000 | 3.000000
5.000000 | 6.000000 | 4.000000
5.000000 | 6.000000 | 5.000000
5.000000 | 6.000000 | 6.000000
5.000000 | 6.000000 | 7.000000
4.000000 | 5.000000 | 1.000000
4.000000 | 5.000000 | 2.000000
4.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/ ------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: reaster@comptechnews.com
Subject: Re: subselect test
In-Reply-To: <0101090206301S.09559@comptechnews>
References: <0101090206301S.09559@comptechnews>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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