望尘轩中一盏茶

统计

留言簿

友情链接

阅读排行榜

评论排行榜

Oracle 删除同名同身份证号的重复数据

        最近处理的系统中出现了大量重复数据,身份证号和姓名一样。而身份证号是作为用户登录系统的用户名,这样如果用户修改了密码,就有可能出现登录不了的情况。
        参阅了相关资料后,找到一种比较方便的删除重复数据的方法,记录如下(方便以后参考):
1delete from t_test where rowid not in
2(select max(t.rowid) from t_test t group by name,cardid);


备份其它的语句:
根据身份证号码更新考生的性别信息:
update t_examinee set eneesex='' where eneesex='X' and length(cardid)=18 and substr(cardid, 171in ('1','3','5','7','9')

update t_examinee set eneesex='' where eneesex='X' and length(cardid)=18 and substr(cardid, 171in ('0','2','4','6','8')

update t_examinee set eneesex='' where eneesex='X' and length(cardid)=15 and substr(cardid, 151in ('1','3','5','7','9')

update t_examinee set eneesex='' where eneesex='X' and length(cardid)=15 and substr(cardid, 151in ('0','2','4','6','8')
更新人员的身份证号码信息:
update t_mytable set cardid=substr(cardid,0,17)||'X' where cardid like '%x' and cardtype='居民身份证' and length(cardid)=18
使用A表的数据更新B表的对应数据:
update t_e1 set (inyear) = (select exyear as inyear 
from t_tempyear where t_e1.eneeid=t_tempyear.eneeid) 
where exists(select 1 from t_tempyear where t_tempyear.eneeid=t_e1.eneeid)


posted on 2009-02-26 10:45 wzhongyu 阅读(802) 评论(0)  编辑  收藏 所属分类: Java学习


只有注册用户登录后才能发表评论。


网站导航:
 
我的便捷门:综合频道 数码频道 商城频道 电器频道 男人频道 女人频道 居家玩具 美容频道 饰品鞋包 食品频道 台湾馆频道