Understanding PIVOT function in SQL.

0

Please login or register to vote for this query.

(click on this box to dismiss)

Open Source Meta

Q&A about the site for people organizing, marketing or licensing open source development projects

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 to main site
loading Hold tight while we fetch your results