RE: Help Crafting a Grouping/Listing Query

From: TJ Kiernan <tkiernan_at_pti-nps.com>
Date: Mon, 6 Apr 2015 21:44:43 +0000
Message-ID: <196DB2D4BDE5804EAF3158CCC1C698BC8BEAB1C4_at_lopez.pti-nps.com>



Check out LISTAGG()

https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions089.htm#SQLRF30030

HTH,
T. J.

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Don Seiler Sent: Monday, April 06, 2015 4:39 PM
To: ORACLE-L
Subject: Help Crafting a Grouping/Listing Query

Oracle 11.2.0.3.

For example let's take v$logfile. Let's say I have 2 logfiles per group#.

I'd like to write a query that selects the group number and then puts all logfiles for that group# in a delimited string in the same row of that result set. So the result would look something like (using commas as the delimiter):

GROUP MEMBERS
----- -------

1        /path/to/group1_01.rdo,/path/to/group1_02.rdo
2        /path/to/group2_01.rdo,/path/to/group2_02.rdo
3        /path/to/group3_01.rdo,/path/to/group3_02.rdo

Hopefully I haven't explained it too poorly. I'm just having trouble wrapping my head around getting the grouping into one field.

Don.

--

Don Seiler
http://www.seiler.us
--

http://www.freelists.org/webpage/oracle-l Received on Mon Apr 06 2015 - 23:44:43 CEST

Original text of this message