Unpivot dynamic columns to rows - missing data from last columns
问题 I have many tables like below, and column names are different each table. id city aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 1 LAX 0.0 0.0 1.0 2.5 0.0 3.0 0.0 0.0 1.0 0.0 1.6 0.0 1.1 2 SFO 1.7 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.4 3 NYC 0.0 1.0 0.0 0.0 4.0 0.0 0.0 0.0 0.0 2.0 0.0 0.0 1.3 And I would like to get result like below for above example table: id city item qty -- ---- ---- ---- 1