Db2 Pivot rows to columns - with two keys

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pauljohn66
    New Member
    • Feb 2021
    • 1

    Db2 Pivot rows to columns - with two keys

    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
Working...