If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > SQL Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-01-04, 05:20
chumpski chumpski is offline
Registered User
 
Join Date: Oct 2003
Posts: 43
SQL Question

I have a query:

select b.operator_id, a.trade_code
from rhm_operator_trades a, rhm_operators b
where b.operator_id = a.operator_id
and b.operator_id = '90177'

which returns:

90177 38
90177 45
90177 50


Is it possible to get the following output from an SQL query
90177 38,45,50

i.e. all the trade codes are concatenated onto one row, against the corresponding operator id record.

I can produce this result in a PL/SQL loop, but I really need to get this output from a single SQL query and I can for the life of me see how it could be done.
So any help would be appreciated.
Reply With Quote
  #2 (permalink)  
Old 09-01-04, 05:22
chumpski chumpski is offline
Registered User
 
Join Date: Oct 2003
Posts: 43
By the wat this is on an Oracle DB
Reply With Quote
  #3 (permalink)  
Old 09-01-04, 06:06
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
It was discussed on the Oracle Forum just a few days ago. Read more about it here.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On