我如何从该表中生成逗号和分号分隔的字符串
具有 3 个字段的结果表
GameId(key) PlayerId(key) Rank
1 1 1
1 2 2
1 3 3
1 4 4
1 5 5
2 1 2
2 2 3
2 3 1
2 4 5
2 5 4
我需要的结果接近于这样的 sql
SELECT PlayerId, count(*) as R1 from Result where Rank = 1
group by PlayerId
union
SELECT PlayerId, count(*) as R2 from Result where Rank < 5
group by PlayerId
分隔字符串应类似于 1,5,8;2,3,7; 这是PlayerId,R1,R2;