一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

SQL 列去重復(fù)

 jsonhan 2015-11-27
SQL去除列中重復(fù)ID
1.select * from his.tbStocktakeInfo
where StocktakeInfoID in (select StocktakeInfoID from 
his.tbStocktakeInfo group by StocktakeInfoID having count(StocktakeInfoID) > 1)
2. 刪除表中多余的重復(fù)記錄,重復(fù)記錄是根據(jù)單個字段(peopleId)來判斷,只留有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ù)記錄(多個字段)
select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)


4、刪除表中多余的重復(fù)記錄(多個字段),只留有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ù)記錄(多個字段),不包含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、select  InventoryID,GoodsName,BatchNo,Format,Cost,GoodsID from dbo.v_BatchGoodsInventory as a 
where BatchNo = (select MIN(BatchNo) 
from dbo.v_BatchGoodsInventory as b 
where a.GoodsID = b.GoodsID )AND StoreID='C8E43A8D-0311-490F-AA5A-84260DFC87EA' 
AND a.Status=1 AND a.GoodsStatus=1 ORDER  BY  a.GoodsName;

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多

    九九九热视频最新在线| 亚洲精品伦理熟女国产一区二区 | 香蕉久久夜色精品国产尤物 | 人妻久久这里只有精品| 欧美日韩亚洲国产精品| 欧美国产在线观看精品| 午夜国产精品福利在线观看| 欧美人妻盗摄日韩偷拍| 亚洲精品蜜桃在线观看| 国产又大又硬又粗又黄| 久久精品福利在线观看| 国产成人亚洲综合色就色| 在线观看视频国产你懂的| 国产精品不卡免费视频| 欧美日韩久久精品一区二区| 九九热这里只有精品哦| 欧美一级内射一色桃子| 搡老熟女老女人一区二区| 好吊日成人免费视频公开| 91国内视频一区二区三区| 国产一级一片内射视频在线| 国产又粗又猛又爽又黄的文字| 九九热这里只有精品哦| 加勒比东京热拍拍一区二区| 免费性欧美重口味黄色| 亚洲视频一级二级三级| 一区二区三区欧美高清| 日韩丝袜诱惑一区二区| 亚洲精品中文字幕一二三| 尤物久久91欧美人禽亚洲| 精品欧美日韩一区二区三区| 中国一区二区三区不卡| 91精品国产综合久久福利| 乱女午夜精品一区二区三区| 亚洲一区二区亚洲日本| 久久精品蜜桃一区二区av| 国产男女激情在线视频| 免费福利午夜在线观看| 日本高清视频在线播放| 国产一级内片内射免费看| 欧美自拍系列精品在线|