偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

5種情況下sql server刪除數(shù)據(jù)的方法

數(shù)據(jù)庫(kù) SQL Server
根據(jù)不同的情況,刪除SQL數(shù)據(jù)庫(kù)中的方法也有所不同,下文介紹了5種情況下sql server刪除數(shù)據(jù)的方法,希望對(duì)您能有所啟迪。

有很多種方法都可以實(shí)現(xiàn)sql server刪除數(shù)據(jù),下面就為您介紹了其中5種最常見(jiàn)的方法,如果您對(duì)sql server刪除數(shù)據(jù)方面感興趣的話,不妨一看。

1、查找表中多余的重復(fù)記錄,重復(fù)記錄是根據(jù)單個(gè)字段(peopleId)來(lái)判斷
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)

2、刪除表中多余的重復(fù)記錄,重復(fù)記錄是根據(jù)單個(gè)字段(peopleId)來(lái)判斷,只留有rowid最小的記錄
delete from people
where peopleId in (select peopleId from people group by peopleId   having count(peopleId) > 1)
and rowid not in (select min(rowid) from people group by peopleId having count(peopleId )>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、sql server刪除數(shù)據(jù)--刪除表中多余的重復(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)
 

 

 

【編輯推薦】

sql server刪除有默認(rèn)值的列的方法

SQL SERVER連接失敗的解決方案

帶您了解SQL Server游標(biāo)

八步輕松搞定SQL Server自動(dòng)備份

SQL Server的優(yōu)點(diǎn)和缺點(diǎn)

責(zé)任編輯:段燃 來(lái)源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-10-22 17:26:55

SQL Server刪

2010-04-25 17:34:30

負(fù)載均衡實(shí)現(xiàn)

2010-09-02 10:15:46

SQL刪除

2010-11-10 11:42:35

SQL Server2

2010-06-30 10:55:13

SQL Server日

2010-07-13 16:07:26

SQL Server行

2010-10-22 16:29:11

SQL Server刪

2010-06-28 15:27:54

SQL Server

2015-06-29 14:11:30

網(wǎng)絡(luò)接入無(wú)線網(wǎng)絡(luò)

2010-11-10 13:28:06

SQL Server刪

2010-09-01 16:55:55

SQL刪除連接

2011-09-13 15:51:54

刪除數(shù)據(jù)庫(kù)重復(fù)行

2010-07-30 15:32:23

2010-07-09 09:34:37

SQL Server數(shù)

2010-09-28 15:46:22

SQL刪除重復(fù)記錄

2018-01-08 19:17:21

數(shù)據(jù)庫(kù)Oracle重啟

2010-11-03 13:09:14

DB2卸載方法

2010-07-19 14:43:21

SQL Server查

2010-10-20 13:52:07

SQL Server數(shù)

2010-10-20 10:19:33

sql server刪
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)