select distinct 't01' as col from talbe where agentid =1000 and t01=2 union all select distinct 't02' as col from talbe where agentid =1000 and t02=2 union all select distinct 't03' as col from talbe where agentid =1000 and t03=2 /
select decode(t01,2,'t01','') as t01, decode(t02,2,'t02','') as t02, decode(t03,2,'t03','') as t03 from table where ... 试试
select column_name from all_tab_columns where table_name='表名'
union all
select distinct 't02' as col from talbe where agentid =1000 and t02=2
union all
select distinct 't03' as col from talbe where agentid =1000 and t03=2
/
decode(t02,2,'t02','') as t02,
decode(t03,2,'t03','') as t03
from table where ...
试试