with t as (select a.name, a.type, row_number() over(partition by type order by name) r from a)
select max(case when type='A' then name end) name1, 'A' type1,
max(case when type='B' then name end) name2, 'B' type2,
max(case when type='C' then name end) name3, 'C' type3
from t
group by r
你直接加 where 条件不就可以啦 :form 表A where type ="A"
用decode函数可以
你的with t(列名)as
想到了行转列PIVOT函数。但是你这个需求,我做不出来。