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 > Database Server Software > DB2 > DB2 Query Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-28-10, 16:07
Phoenixb Phoenixb is offline
Registered User
 
Join Date: Aug 2008
Posts: 4
DB2 Query Question

I was hoping someone could help me out with this.

I have table columns like this

CALLID PatternId (these are the ones I care about for this example)

Data could be

1111 02
1111 333
1111 05
1111 02
1234 01
1234 02
1234 122
2222 243
2222 76


I want to process the table and get a result set like this

1111 02-222-05-02
1234 01-02-122
2222 243-76

there could be up to 200 rows per callid.

IS there a way to write a query in DB2 to accomplish this??
Reply With Quote
  #2 (permalink)  
Old 04-28-10, 16:26
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Yes. This question gets asked at least once a month. Search the forum for "pivot table". There are numerous examples.

Andy
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