Change rows to columns specifically in sql 2005
Posted on 2008-11-06
Take a look at my query result ...
.... Here d1, d2 are date fields and value is double
My query goes like this
SELECT T.DURATION AS VALUE ,(DATEADD(D, 0, DATEDIFF(D, 0, START_DATETIME))) AS DATE,START_DATETIME from [TRAINING-SESSION] AS T JOIN [SCHEDULE-ACT] AS S
ON T.I_SCHEDULE_ACT = S.I_SCHEDULE_ACT
START_DATETIME between @pistartdate and @pienddate
But The result i want is of the form
d1 1.1 2.7 3.1
d2 4.6 2.2
This means those values with similar dates are grouped to become
How could i achieve this ... Thanks In advance... Am a newcomer to
this site.. and am running out of points So am awarding lesser points
eventhough i know its worth more....