column names are row values from another table. [message #628164] |
Thu, 20 November 2014 14:07 |
shree_z
Messages: 75 Registered: February 2008
|
Member |
|
|
I have a calendar table with dates and attributes
In a work_hours table there are columns week1, week2, week3... week52. these columns has data - number of hours worked in that corresponding weeks.
week1 week2 week3...
4 3 5
Now I want to rename week1 with the actual week_start_date from the calendar table for the date corresponding to week_number = 1
calendar table
week_number week_start_date
1 1/1/2014
2 1/8/2014
3 1/15/2014
I want the final table to be like this
1/1/2014 1/8/2014 1/15/2014..
4 3 5
Can I use PIVOT? But I have no idea how to do this.
Thanks in advance
[Updated on: Thu, 20 November 2014 14:12] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|