CREATE TABLE #yt ([Client_ID] int, [Upsell_Rank] int, [Up...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Skeptics

Q&A for scientific skepticism

CREATE TABLE #yt
    ([Client_ID] int, [Upsell_Rank] int, [Upsell_Strength] int, Policy_Type int, )
;
    
INSERT INTO #yt
    ([Client_ID], [Upsell_Rank], [Upsell_Strength], Policy_Type)
VALUES
    (102, 0, 96, 101),
    (102, 1, 50, 115),
    (102, 2, 40, 103)
;


select *
from 
(
  select Client_ID, Upsell_Rank, Upsell_Strength, Policy_Type
  from #yt
) src
pivot
(
  sum(Upsell_Strength)
  for Upsell_Rank in ([0], [1])
) piv;

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results