Hi,
I am recording results of matches between various teams in various tournaments.
My columns for the score table are HomeTeam, AwayTeam, Tournament, HomePoints, AwayPoints.
e.g.
HomeTeam|AwayTeam|Tournament|PointsHome|PointsAway
----------------------------------------------------------
A B T1 1 2
A B T2 3 4
I want to pivot this to produce a table like:
HomeTeam|AwayTeam|T1_HomePoints|T1_AwayPoints|T2_HomePoints|T2_AwayPoints
------------------------------------------------------------------------------------
A B 1 2 3 4
Can this be done in SQL Server 2005?
Thanks
I am recording results of matches between various teams in various tournaments.
My columns for the score table are HomeTeam, AwayTeam, Tournament, HomePoints, AwayPoints.
e.g.
HomeTeam|AwayTeam|Tournament|PointsHome|PointsAway
----------------------------------------------------------
A B T1 1 2
A B T2 3 4
I want to pivot this to produce a table like:
HomeTeam|AwayTeam|T1_HomePoints|T1_AwayPoints|T2_HomePoints|T2_AwayPoints
------------------------------------------------------------------------------------
A B 1 2 3 4
Can this be done in SQL Server 2005?
Thanks