Understanding PIVOT function in SQL.

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A about the site for music historians, critics, and fans

declare @DataTable table
(
  ID int,
  TeamID int,
  UserID  int,
  ElementID int,
  PhaseID int,
  Effort float
)
insert into @DataTable values
(1, 1,   1,  3,  5, 1.00),
(1, 1,   1,  3,  6, 2.00),
(1, 1,   1,  4,  1, 3.00),
(1, 1,   1,  4,  5, 4.00),
(1, 1,   1,  4,  6, 5.00)

select * from @DataTable

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results