62,046
社区成员
发帖
与我相关
我的任务
分享
id name
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
create table test(
id int,
name nvarchar(10)
)
insert into test values(1,'a')
insert into test values(2,'b')
insert into test values(3,'c')
select r from
(select nid,max(a)+'.'+max(b)+'.'+max(c) as r from
(select nid=1,
a=case when name='a' then 'a' else '' end,
b=case when name='b' then 'b' else '' end,
c=case when name='c' then 'c' else '' end
from test)t
group by nid)tt