nested sub-select ? - Mailing list pgsql-sql

From Chris Martin
Subject nested sub-select ?
Date
Msg-id 20000605212923.90074.qmail@hotmail.com
Whole thread Raw
List 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)
ASEmployees
 
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



pgsql-sql by date:

Previous
From: Aaron Sethman
Date:
Subject: Finding number of updated rows in pl/pgsql
Next
From: Tom Lane
Date:
Subject: Re: Vacuum problem in my system ?