I need help with creating a pivot table. I've already tried many offered solutions here but I am stuck. Hope someone can help. Here's my scenario:
Table1 sample
ID              text    2712cb957
document_key    text    201808
Table2 sample
ID          text    2712cb957
amount_net  int     56000
classid     int     4021
Table3 (from Table1 and Table2 via inner join ID)
document_key    amount_net  classid
201808          10          4021
201808          10          4021
201808          15          4023
201808          13          4023
201807          20          4021
201807          15          4021
…               …           …
Expected pivot table
document_key    4021    4023
201807          35      0
201808          20      28

 
     
    