删除 重复行

delete from C_CHAR_SEQUENCE WHERE id in (select id from (
select id ,ROW_NUMBER() over(partition by PRIORITY,SEQUENCE,land, SOURCE,MATERIAL,char order by changedate desc) numNo from C_CHAR_SEQUENCE with(nolock)
) aaa
where numno > 1
)

 

 

 

with Duplis as (
select * ,ROW_NUMBER() over(partition by MATERIAL,land, char,PRIORITY order by changedate desc) numNo
,RANK() over(partition by MATERIAL,land, char,PRIORITY order by changedate desc) numRA from C_CV_DEFAULT with(nolock)
)
select * from Duplis
where
numNo<>numRA

posted @ 2018-05-16 17:43  applekingghfhfhbr  阅读(135)  评论(0编辑  收藏  举报