人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動(dòng)態(tài)

sqlserver清除完全重復(fù)的數(shù)據(jù)只保留重復(fù)數(shù)據(jù)中的第一條

發(fā)布日期:2021-12-28 01:32 | 文章來(lái)源:源碼中國(guó)
--創(chuàng)建測(cè)試表 
CREATE TABLE [dbo].[testtab]( 
[id] [nchar](10) NULL, 
[name] [nchar](10) NULL 
) ; 
--向測(cè)試表插入測(cè)試數(shù)據(jù) 
insert into testtab values('1','1'); 
insert into testtab values('1','1'); 
insert into testtab values('2','2'); 
insert into testtab values('2','2'); 
insert into testtab values('3','3'); 
insert into testtab values('3','3'); 
--創(chuàng)建臨時(shí)表并向臨時(shí)表中插入測(cè)試表testtab中數(shù)據(jù)以及添加自增id:autoID 
select identity(int,1,1) as autoID, * into #Tmp from testtab 
--根據(jù)autoID刪除臨時(shí)表#tmp中的重復(fù)數(shù)據(jù),只保留每組重復(fù)數(shù)據(jù)中的第一條 
delete #Tmp where autoID in(select max(autoID) from #Tmp group by id); 
--清除testtab表中的所有數(shù)據(jù) 
delete testtab; 
--向testtab表中插入#Tmp表中被處理過(guò)的數(shù)據(jù) 
insert into testtab select id,name from #Tmp; 
--刪除臨時(shí)表#Tmp 
drop table #Tmp;

版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實(shí)時(shí)開(kāi)通

自選配置、實(shí)時(shí)開(kāi)通

免備案

全球線路精選!

全天候客戶(hù)服務(wù)

7x24全年不間斷在線

專(zhuān)屬顧問(wèn)服務(wù)

1對(duì)1客戶(hù)咨詢(xún)顧問(wèn)

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部