Mi piacerebbe sapere come UNPIVOT Table_1
in Expected_Result_Table
:Trasporre colonne dinamiche a righe
Table1
-----------------------------------------
Id abc brt ccc ddq eee fff gga hxx
-----------------------------------------
12345 0 1 0 5 0 2 0 0
21321 0 0 0 0 0 0 0 0
33333 2 0 0 0 0 0 0 0
41414 0 0 0 0 5 0 0 1
55001 0 0 0 0 0 0 0 2
60000 0 0 0 0 0 0 0 0
77777 9 0 3 0 0 0 0 0
Expected_Result_Table
---------------------
Id Word Qty>0
---------------------
12345 brt 1
12345 ddq 5
12345 fff 2
33333 abc 2
41414 eee 5
41414 hxx 1
55001 hxx 2
77777 abc 9
77777 ccc 3
Così, Come trasporre le colonne in Table_1
conseguente Expected_Result_Table
, considerando solo i valori> 0 ?
Ciao, bluefeet! Hai appena risolto il problema. Molte grazie! –
Questo è fantastico .. fa la magia :) – UberNeo