Extracting Multiple rows as columns of single row



IBM's flagship relational database management system

Extracting Multiple rows as columns of single row

Postby madlaks » Tue May 01, 2018 6:43 am

I have 2 Tables like below and trying to extract 1 record per account by joining 2 tables. I retrieved as multiple rows, but would like to extract as 1 record

Table1
ID  ACCT  PROD ID
1   1234  P1
1   1234  P3


Table2
Prod ID  Prod Name
P1       Product 1
P2       Product 2
P3       Product 3

Expected Result
1234, Product 1, Product 3


Is it possible to extract in single query. I tried CASE WHEN but couldn't figure it out

Use the code tags when presenting data. Coded for you this time.
madlaks
 
Posts: 1
Joined: Tue May 01, 2018 6:32 am
Has thanked: 0 time
Been thanked: 0 time

Re: Extracting Multiple rows as columns of single row

 

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post