I have the following query :
- SELECT Custid, Shipperid, Freight
- FROM Sales.FreightTotals
- UNPIVOT( Freight FOR Shipperid IN([1],[2],[3]) ) AS U;
custid shipperid freight
1 1 98
1 3 55
2 2 75
This is my expected output :
custid shipperid freight
1 1 98
1 2 NULL
1 3 55
2 1 NULL
2 2 75
2 3 NULL
Amira BedhiafiPosted Mar 31, 2021, 2:53 PM