34,594
社区成员
发帖
与我相关
我的任务
分享
insert into b
select col2 col3 col4 col5 col6 col7 col8 col9 from ta a
where not exists ( select 1 from ta where col2=a.col2 and id>a.id)
and not exists ( select 1 from ta where col2=a.col2 and id>a.id)
and not exists ( select 1 from ta where col3=a.col3 and id>a.id)
and not exists ( select 1 from ta where col4=a.col4 and id>a.id)
and not exists ( select 1 from ta where col5=a.col5 and id>a.id)
delete
t
from
a t
where
exists(select 1 from a where col2=t.clo2 and col3=t.col3 and col4=t.col4 and col5=t.col5 and col1<>t.col1)