.表名:Pid_Area_Phone
AID UserName Phone
1 小李 123456
1 小樱 456789
1 小南 321654
2 小李 123456
2 小樱 456789
2 小南 321654
怎么变成
AID UserName Phone
1 小李 ,小樱,小南 123456,456789 ,321654
2 小李 ,小樱,小南 123456,456789 ,321654
create table [Pid_Area_Phone]([AID] int,[UserName] nvarchar(4),[Phone] int)
insert [Pid_Area_Phone]
select 1,N'小李',123456 union all
select 1,N'小樱',456789 union all
select 1,N'小南',321654 union all
select 2,N'小李',123456 union all
select 2,N'小樱',456789 union all
select 2,N'小南',321654
------解决方案--------------------
create table [Pid_Area_Phone]([AID] int,[UserName] nvarchar(4),[Phone] int)
insert [Pid_Area_Phone]
select 1,N'小李',123456 union all