select t.task_id,
max(decode(t.ps_org_no, '35406', t.value)) a,
max(decode(t.ps_org_no, '3540601', t.value)) b,
max(decode(t.ps_org_no, '3540602', t.value)) c,
max(decode(t.ps_org_no, '3540603', t.value)) d
from s_csqe_eva_rslt t
where t.task_id = '28884'
and t.content_id = '24730'
group by t.task_id;
删除重复值
方法二: delete from demo where rowid in
(select rid from
(select rowid rid,row_number() over(partition by object_id order by rowid) rn
from demo)
where rn <> 1 );
耗时:30秒
方法三: create table demo2 as
select object_id,owner... from
(select demo.*,row_number() over(partition by object_id order by rowid) rn from demo)
where rn = 1;
truncate table demo; insert into demo select * from demo2; drop table demo2;
共耗时: 10秒,适合大数据量的情况,产生更少回滚量;