當(dāng)前位置:工程項(xiàng)目OA系統(tǒng) > 領(lǐng)域應(yīng)用 > 倉(cāng)庫(kù)進(jìn)銷存管理系統(tǒng) > 入庫(kù)出庫(kù)管理軟件
用SQL語(yǔ)句,熟練使用刪除語(yǔ)句
申請(qǐng)免費(fèi)試用、咨詢電話:400-8352-114
用SQL語(yǔ)句,刪除掉重復(fù)項(xiàng)只保留一條在幾千條記錄里,存在著些相同的記錄,如何能用SQL語(yǔ)句,刪除掉重復(fù)的呢
1、查找表中多余的重復(fù)記錄,重復(fù)記錄是根據(jù)單個(gè)字段(peopleId)來判斷
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
2、刪除表中多余的重復(fù)記錄,重復(fù)記錄是根據(jù)單個(gè)字段(peopleId)來判斷,只留有rowid最小的記錄
delete from people
where peopleName in (select peopleName from people group by peopleName having count(peopleName) > 1)
and peopleId not in (select min(peopleId) from people group by peopleName having count(peopleName)>1)
3、查找表中多余的重復(fù)記錄(多個(gè)字段)
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
4、刪除表中多余的重復(fù)記錄(多個(gè)字段),只留有rowid最小的記錄
delete from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)
5、查找表中多余的重復(fù)記錄(多個(gè)字段),不包含rowid最小的記錄
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)
6.消除一個(gè)字段的左邊的第一位:
update tableName set [Title]=Right([Title],(len([Title])-1)) where Title like '村%'
7.消除一個(gè)字段的右邊的第一位:
update tableName set [Title]=left([Title],(len([Title])-1)) where Title like '%村'
8.假刪除表中多余的重復(fù)記錄(多個(gè)字段),不包含rowid最小的記錄
update vitae set ispass=-1
where peopleId in (select peopleId from vitae group by peopleId
- 1編程總結(jié)之關(guān)于編程的淺學(xué)習(xí)與深學(xué)習(xí)
- 2操作系統(tǒng)各大公司筆試題匯總
- 3如何重新安裝IE瀏覽器
- 4雙系統(tǒng)的安全卸載
- 5 WINXP優(yōu)化精髓,如何加快開機(jī)與關(guān)機(jī)的速度
- 6Explorer.exe程序在系統(tǒng)中的作用
- 7操作系統(tǒng)進(jìn)程描述
- 8內(nèi)部網(wǎng)上的IP地址應(yīng)該如何設(shè)置
- 9禁止光盤自動(dòng)運(yùn)行
- 10開始菜單響應(yīng)速度過慢
- 11如何直接移動(dòng)應(yīng)用程序
- 12操作系統(tǒng)停止響應(yīng)
- 13網(wǎng)卡沒有安裝成功該怎么解決
- 14命令設(shè)計(jì)模式
- 15巧妙安裝各種Windows操作系統(tǒng)
- 16"文件保護(hù)"的解決方法,按以下步驟關(guān)閉文件保護(hù)
- 17WinXP瘦身辦法
- 18常遇電腦故障應(yīng)急處理方法
- 19銷售庫(kù)存管理軟件 05.41.26
- 20Windows常用命令集
- 21入庫(kù)出庫(kù)管理軟件架構(gòu)之入庫(kù)出庫(kù)管理軟件軟件架構(gòu)
- 22電腦顯示器的相關(guān)設(shè)置與常見故障排除方法
- 23如何知道局域網(wǎng)中所有計(jì)算機(jī)的IP地址
- 24光驅(qū)讀盤不正常
- 25無(wú)法升級(jí)更新
- 26禁止ipc$默認(rèn)共享的方法
- 27什么是POP3
- 28應(yīng)用程序不能啟動(dòng)
- 29打開硬盤分區(qū)出錯(cuò)
- 30群相冊(cè)怎么看最近訪客
成都公司:成都市成華區(qū)建設(shè)南路160號(hào)1層9號(hào)
重慶公司:重慶市江北區(qū)紅旗河溝華創(chuàng)商務(wù)大廈18樓