0

I've got a query that returns a couple columns with multiple records. I want to join those records into one, separating them with a comma. I've found a few different potential ways to do this (such as: http://www.williamrobertson.net/documents/one_row.html). This reference is perfect except I don't want to group by another column like they are doing with DEPTNO and I can't figure out how to do it without that grouping.

Instead of:

PRODUCT_NAME  SEQUENCE  LNAME  FNAME  EVENT_ID  
ITEM1          2    Smith  John   1234567890  
ITEM2            1  Smith  John   1234567890

I want the following, ordered by the sequence ascending:

PRODUCT_NAME     LNAME  FNAME  EVENT_ID  
ITEM2, ITEM1     Smith  John   1234567890    

Current Query:

select p.display_name,ed.sequence,c.*, e.*, ea.*
from event e,event_address ea,customer c,event_detail ed,product p
where c.customer_id=e.customer_id
and ea.event_id=e.event_id
and e.employee_id=xxxxxxxxxx
and c.customer_id=xxxxxxxxxx
and start_date_time between '06/30/2011' and sysdate
and e.event_id=ed.event_id
and ed.product_id=p.product_id
order by e.start_date_time desc

I appreciate any assistance in advance :)

Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084
Nate D.
  • 23
  • 2
  • I thought this would be a simple request. Is this not possible or something? – Nate D. Aug 02 '11 at 18:18
  • http://stackoverflow.com/questions/4686543/sql-query-to-concatenate-column-values-from-multiple-rows-in-oracle http://stackoverflow.com/questions/4686543/sql-query-to-concatenate-column-values-from-multiple-rows-in-oracle – user1933888 Jul 21 '14 at 07:53

0 Answers0