May 23, 2011 at 12:14 pm
Hi all
I have a table containing information looking like the below:
Team Name EType Week Availability
USA Chuck P 02/05/2011 3
USA Ross P 02/05/2011 5
UK Paul P 02/05/2011 5
USA Chuck P 09/05/2011 5
USA Ross P 09/02/2011 4
UK Paul P 09/02/2011 5
I am required to place the above information into another table looking like the below, using T-SQL:
Team Name EType Week1 (which will be the week 02/05/2011) Week2
USA Chuck P 3 (this is the availability for Paul for week 02/05/2011) 5
USA Ross P 5 4
UK Paul P 5 5
From looking at the above datasets you can see the first three columns (Team, Name, EType) I have kept the same. However, I am required to flip/pivot the Date/Week and Availability columns
Please can someone show me how to do this???
Thanks in advance.
May 23, 2011 at 12:31 pm
Check out the articles in my signature on Cross Tabs and Pivot Tables (Parts 1 and 2). This should give you all the information you need.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply