sql重複資料的處理

2023-01-23 20:25:38 字數 872 閱讀 8628

1樓:黑夜霞光丶

select * from 表 a where not exists(select * from 表 where id=a.id and dt=a.dt)

這樣試試呢

這樣with a as (

select * from 表 a where not exists(select * from 表 where id=a.id and dt=a.dt)

)insert into b (欄位,欄位,欄位)select 欄位,欄位,欄位 from a

2樓:匿名使用者

select distinct(id+dt) from table

如果id和dt不同型別,就在括號裡按字串合併

3樓:匿名使用者

select

*from

表 main

where

not exists (

select 1 from 表 sub1 where main.id = sub1.id and main.dt <> sub1.dt

)and

not exists (

select 1 from 表 sub2 where main.id <> sub2.id and main.dt = sub2.dt)

4樓:匿名使用者

insert into talbe b select distinct id,dt from tablea

5樓:匿名使用者

select distinct dt ,id,num from table order by id

sqlserver怎麼刪除重複資料

with cte as select col1 col2 col3 col4 col5 col6 col7 rn row number over partition by col1 order by col1 from dbo.table1 delete from cte where rn 1 如何...

excel刪除特定的重複資料,excel刪除特定條件下的重複項

可以使用vlookup函式,關鍵是看你的資料裡有沒有一列是關鍵字,例如,小李只有一條記錄,不會說有小李上海,小李北京兩條。如果你的資料沒有關鍵字列,可以嘗試和並兩列的資料,比如小李上海為一列,小李北京為一列,這樣就可以作為唯一標示了。合併在新列中寫 a1 b1,拖拉即可。假設a列為關鍵字,新建一列d...

excel重複資料不留全部刪除,excel重複資料一個不留全部刪除

假設這些資料在a列,另起一列b,在b1輸入下列公式 countif a a,a1 下拉.將所有結果大於1的行篩選出來刪除即可 假設你的資料在a列 在b1輸入公式 if countif a a,a1 1,刪除 雙擊b1右下角的實心小黑點完成全列填充 選擇ab兩列後按b列排序,把要刪除的排在一起,批量刪...