nested sub-select ?

From: "Chris Martin" <chrismartin_(at)hotmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: nested sub-select ?
Date: 2000-06-05 21:29:22
Message-ID: 20000605212923.90074.qmail@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-06-06 00:08:33 Re: Vacuum problem in my system ?
Previous Message Aaron Sethman 2000-06-05 21:08:09 Finding number of updated rows in pl/pgsql