Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pivot data with two key fields

Status
Not open for further replies.

Pauljohn44

Technical User
Feb 2, 2021
1
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top