We are using MS SQL 2008R2
my current Table looks like this:
Date Name KW1 KW2 KW3 .... KW52
xz uy NULL 29.4 34 NULL
xy xy NULL NULL 4 13.8
xy xy NULL NULL NULL 13.8
xz uy 13.5 29.4 34 NULL
So I've got 52 columns (all weeks of a year) but for each row there are only 8 Values of Data, this means: 8 Values with data and 44 values with NULL in each row.
I would now like to combine the columns to get only 8 of them and no NULL values in my select statement.
The Table above is not the source its the result of a pivot select statement
select top 10 * from
(select [Date], Name, datepart(wk,StartDate)+1-datepart(wk,'Jan 04,'+CAST(datepart(yy,StartDate) as CHAR(4))) as KW, Price from Tablex
FOR KW IN
, , , , .... , , , 
) AS pvt order by [Date] desc
Is there a way to combine the result?