Using MS-SQL I am looking for the best way to construct a conditional crosstab query I guess is the best way to describe it.
Simplifying it here, I have a dataset of CLIENTS (each with a unique ID). Each of these clients is assigned to a TEAM. Most clients are assigned to only 1 team, however some can be assigned to 2, 3 or up to 5 teams. I would like my query results to look like the following:
Client_ID Assigned_Team1 Assigned_Team2 Assigned_Team3 Assigned_Team4 Assigned_Team5
--------- -------------- -------------- -------------- -------------- --------------
87496 Red Team Null Null Null Null
74559 Red Team Blue Team White Team Null Null
56345 Blue Team Green Team Null Null Null
21473 Yellow Team Blue Team White Team Red Team Green Team