///查询生成交叉列表
CREATE TABLE AA
( AID int,
ANAME VARCHAR(10),
AKM VARCHAR(10)
)
insert into AA values(1,'A','G');
insert into AA values(2,'A','R');
insert into AA values(3,'A','B');
insert into AA values(4,'B','B');
insert into AA values(5,'B','R');
insert into AA values(6,'C','R');
select * from aa
select ANAME,
max(case AKM when 'R' then 'R' else '' end)
+max(case AKM when 'G' then 'G' else '' end)
+max(case AKM when 'B' then 'B' else '' end) AKM
from aa
group by ANAME