望塵軒中一盞茶

          統(tǒng)計(jì)

          留言簿

          友情鏈接

          閱讀排行榜

          評論排行榜

          Oracle 刪除同名同身份證號的重復(fù)數(shù)據(jù)

                  最近處理的系統(tǒng)中出現(xiàn)了大量重復(fù)數(shù)據(jù),身份證號和姓名一樣。而身份證號是作為用戶登錄系統(tǒng)的用戶名,這樣如果用戶修改了密碼,就有可能出現(xiàn)登錄不了的情況。
                  參閱了相關(guān)資料后,找到一種比較方便的刪除重復(fù)數(shù)據(jù)的方法,記錄如下(方便以后參考):
          1delete from t_test where rowid not in
          2(select max(t.rowid) from t_test t group by name,cardid);


          備份其它的語句:
          根據(jù)身份證號碼更新考生的性別信息:
          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表的數(shù)據(jù)更新B表的對應(yīng)數(shù)據(jù):
          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 閱讀(828) 評論(0)  編輯  收藏 所屬分類: Java學(xué)習(xí)

          我的便捷門:綜合頻道 數(shù)碼頻道 商城頻道 電器頻道 男人頻道 女人頻道 居家玩具 美容頻道 飾品鞋包 食品頻道 臺灣館頻道
          主站蜘蛛池模板: 双城市| 祁阳县| 内丘县| 龙里县| 廉江市| 左云县| 西安市| 台州市| 姚安县| 沂源县| 通江县| 蒲城县| 和静县| 广河县| 东山县| 凯里市| 瓮安县| 德钦县| 镇巴县| 阿克| 庄浪县| 云安县| 旺苍县| 大冶市| 枞阳县| 镇赉县| 唐山市| 施秉县| 新建县| 岢岚县| 普安县| 明光市| 大庆市| 峨眉山市| 宜君县| 鄱阳县| 连州市| 兴和县| 泗阳县| 鹤壁市| 阳谷县|