刪除mysql數(shù)據(jù)庫中的重復(fù)數(shù)據(jù)記錄
更新時間:2008年06月17日 19:18:22 作者:
mysql中select distinct * from text不能顯示不重復(fù)的記錄,而是直接全部顯示
采用的是下面的方法可刪除,假設(shè)重復(fù)的是test數(shù)據(jù)庫中的title字段
create table bak as (select * from test group by title having count(*)=1);
insert into bak (select * from test group by title having count(*)>1);
truncate table test;
insert into test select * from bak;
復(fù)制代碼 代碼如下:
create table bak as (select * from test group by title having count(*)=1);
insert into bak (select * from test group by title having count(*)>1);
truncate table test;
insert into test select * from bak;
您可能感興趣的文章:
相關(guān)文章
mysql8.0?lower_case_table_names?大小寫敏感設(shè)置問題解決
在默認情況下,這個變量是設(shè)置為0的,以保持向前兼容性,如果將該變量設(shè)置為1,則表名和數(shù)據(jù)庫名將被區(qū)分大小寫,本文主要介紹了mysql8.0?lower_case_table_names?大小寫敏感設(shè)置問題解決,感興趣的可以了解一下2023-09-09
Java將excel中的數(shù)據(jù)導(dǎo)入到mysql中
這篇文章主要介紹了Java將excel中的數(shù)據(jù)導(dǎo)入到數(shù)據(jù)庫,小編覺得挺不錯的,現(xiàn)在分享給大家,需要的朋友可以參考借鑒2018-05-05

