Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Return multiple-rowed subqueries as additional columns

Re: Return multiple-rowed subqueries as additional columns

From: Sybrand Bakker <sybrandb_at_hccnet.nl>
Date: Thu, 13 Jan 2005 23:08:00 +0100
Message-ID: <99sdu0t9s0r12broheur932bq51m1qvf06@4ax.com>


On Thu, 13 Jan 2005 14:54:30 -0500, Graeme D <user_at_place.com> wrote:

>I have a database of support tickets I am querying. there is a main
>table and a status table which can have 0 or more rows per associated
>ticket.
>
>Is there a way for me to return multiple rows of data from the status
>table into one resulting row while also querying the main ticket?
>
>Here is what I have so far:
>
>SELECT Ticket, Misc1, Misc2,
>(SELECT TOWKGRPNAME FROM ACTREFEROUT RO WHERE Ticket='xxyyzz') rog1,
>FROM Ticket WHERE TKTNUM='xxyyzz'
>
>What I want is to somehow return all rows of the subquery as diff
>columns in the main query, like so:
>
>Ticket, Misc 1, Misc 2, rog1, rog2, rog3
>
>is this even possible?
>
>Thanks
>Graeme

Not using plain sql. You would need a PL/SQL procedure to do this.

--
Sybrand Bakker, Senior Oracle DBA
Received on Thu Jan 13 2005 - 16:08:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US