望塵軒中一盞茶

          導航

          <2009年2月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          1234567

          公告


          經典書籍
          Java核心技術

          Java核心技術 卷二

          Java編程思想 第四版

          隨筆分類

          隨筆檔案

          統計

          留言簿

          友情鏈接

          閱讀排行榜

          評論排行榜

          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 閱讀(828) 評論(0)  編輯  收藏 所屬分類: Java學習

          我的便捷門:綜合頻道 數碼頻道 商城頻道 電器頻道 男人頻道 女人頻道 居家玩具 美容頻道 飾品鞋包 食品頻道 臺灣館頻道
          主站蜘蛛池模板: 密山市| 保德县| 驻马店市| 宣化县| 芜湖市| 凤台县| 毕节市| 安达市| 南宁市| 舟山市| 修文县| 浑源县| 鲁山县| 应城市| 塔城市| 新泰市| 错那县| 大姚县| 德阳市| 宜兰市| 客服| 嘉义市| 元江| 海城市| 佛学| 鄂温| 耒阳市| 新安县| 海林市| 凭祥市| 乡宁县| 洛浦县| 辉县市| 左权县| 石棉县| 新昌县| 习水县| 灵武市| 连云港市| 中超| 偏关县|