Received: from hotmail.com (law2-f74.hotmail.com [216.32.181.74]) by hub.org (8.10.1/8.10.1) with SMTP id e55LTTW90259 for ; Mon, 5 Jun 2000 17:29:29 -0400 (EDT) Received: (qmail 90075 invoked by uid 0); 5 Jun 2000 21:29:23 -0000 Message-ID: <20000605212923.90074.qmail@hotmail.com> Received: from 62.252.136.138 by www.hotmail.com with HTTP; Mon, 05 Jun 2000 14:29:22 PDT X-Originating-IP: [62.252.136.138] From: "Chris Martin" To: pgsql-sql@postgresql.org Subject: nested sub-select ? Date: Mon, 05 Jun 2000 21:29:22 GMT Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Archive-Number: 200006/50 Hi, Anyone know if Postgresql can replicate this Oracle nested sub-select query (it uses the Oracle CURSOR operator) SELECT deptname, CURSOR (SELECT Empname, Sal FROM emp WHERE emp.deptno=department.deptno) AS Employees FROM department Where deptno=x I want to output a nested list like this (ie. rows from the aliased employees table within their respective department) Deptname: Sales Employees-row-no: 1 Empname: Smith Sal: 2000 Employees-row-no: 2 Empname: Jones Sal: 1000 .... It would be very useful to have the ability to nest multiple CURSOR statements (or equivalent) within the SELECT clause. Any help appreciated. TIA Chris Martin ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com