若是數據庫中有兩條或多條重複的數據【刨掉重複數據,重複數據只顯示一條用 distinct 關鍵字】數據庫
查詢語句:select t.*, t.rowid from mytest t;test
使用distinct後語句:select distinct id,name,price,kucun,isbn from mytest;select
這濾掉了一條徹底重複的數據語法
若是是想保留重複數據的一條im
使用語句語法:delete from t where rowid not in (select min(rowid) from t group by 去重字段);數據
語句:delete from mytest where rowid not in (select min(rowid) from mytest group by isbn);查詢
結果顯示:img
這會的數據只保留了重複要去重字段的一條數據,其餘的數據都已經刪除了!di