日期:2014-05-17 浏览次数:20579 次
select b.id,
(case when b.a is not null then b.a +';' else '' end) +
(case when b.b is not null then b.b +';' else '' end) +
(case when b.c is not null then b.c +';' else '' end) +
(case when b.d is not null then b.d +';' else '' end) +
(case when b.e is not null then b.e +';' else '' end) +
(case when b.f is not null then b.f +';' else '' end) name
from(select id,
max(case name when 'a' then name else null end) a,
max(case name when 'b' then name else null end) b,
max(case name when 'c' then name else null end) c,
max(case name when 'd' then name else null end) d,
max(case name when 'e' then name else null end) e,
max(case name when 'f' then name else null end) f
from tb_user_info
group by id) b