服務(wù)熱線
153 8323 9821
select distinct name from table 選擇name字段無重復(fù)記錄的的數(shù)據(jù),但是只能選擇比較的字段,多個(gè)別的字段則無效
select min(id) as id,name from table group by name 選擇name字段無重復(fù)記錄的的數(shù)據(jù),可以同時(shí)選擇其它字段
select * from table where id not in(select min(id) from table group by name) 選擇name字段重復(fù)記錄的的數(shù)據(jù),每一條記錄保留一條后顯示出來的,也就是多余的記錄,可以刪除的
delete from table where id not in(select min(id) from table group by name) 刪除所有重復(fù)記錄(重復(fù)記錄中只留下ID最小的該條記錄)
select * from table where name in(select name from table group by name having count(name)>1) 選擇name字段有重復(fù)記錄的的數(shù)據(jù),比如某個(gè)記錄出現(xiàn)了3次,著三次都在這個(gè)選擇結(jié)果中
select * from table where name like"%河北包裝印刷網(wǎng)%"選擇所有name為河北包裝印刷網(wǎng)的記錄,注意:此句中雙引號(hào)應(yīng)該為單引號(hào)