471,337 Members | 1,083 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Db2 Pivot rows to columns - with two keys

1 Bit
Hoping someone can help, I am working with a db2 database and I am trying to pivot some data to turn it from rows to columns. My data table looks like this

ID Date Value Key ValueB
One 01/01/2020 Blue Abc
One 01/01/2020 Pink Def
One 02/02/2020 Purple Ghi
Second 01/01/2020 Blue Jkl
Second 01/01/2020 Pink Mno
I’m looking for my output data to look something like this

ID Date Blue Pink Purple
One 01/01/2020 Abc Def
One 02/01/2020 ghi
Second 02/01/2020 Jkl Mno
Thank you in advance. I think case statements might work but not sure how to approach it
Feb 2 '21 #1
0 1905

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by J055 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.