pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Martin <chrismartin_@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: nested sub-select ?
Date: Mon, 05 Jun 2000 21:29:22 GMT
Message-ID: <20000605212923.90074.qmail@hotmail.com> (raw)

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




Message-ID: <20000605212923.90074.qmail@hotmail.com>
Permalink:  ../20000605212923.90074.qmail@hotmail.com/
Also on:    postgresql.org/message-id/20000605212923.90074.qmail@hotmail.com

 · 

reply

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: chrismartin_@hotmail.com
  Subject: Re: nested sub-select ?
  In-Reply-To: <20000605212923.90074.qmail@hotmail.com>
  References: <20000605212923.90074.qmail@hotmail.com>

* 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