您的位置:首页 > 其它

同一个表中排除相同的同一个人(身份证有15位和18位)

2012-05-23 17:12 190 查看
select * from
(select name,idcard,city ,DepartName,substring(idcard,7,9) id1 ,substring(idcard,1,6) part1 from [Constable] where len(idcard)=15) a1
inner join
(select name,idcard,city,DepartName ,substring(idcard,9,9) id2,substring(idcard,1,6) part2 from [Constable] where len(idcard)=18) a2
on (a1.id1=a2.id2 and a1.part1 =a2.part2);


同一个表中在更新数据的时候获取了重复的人员,这条语句就是找出重复的人员,刚刚用到写出来的 分享一下
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: