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