开发者

expanding a table so it's grouped by a value

I have one table that has the follwing columns

Team ID    |     Member
1                   2 
1                   4 
1                   1
2                   3 
2                   1 

How could I return a table that has the first column as the team Id and in the subsequent col开发者_高级运维umns, the members.

Members can be in more than 1 team.

1 | member 1 | member 2 |  Null      |  ... 
2 | member 1 |  Null    |  member 3  |  ...


like hatchet suggested if you know the maximum numbers of members per team you can pivot your table for all those values.

am guessing that those are member ids and their names etc are in a separate table, if so you'd have to join on the ids. I'd write out a sample pivot query for you but the data u've given isnt sufficient

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜