把所有不唯一的组合查出来 select col1,col2 from test group by col1,col2 having count(*) >1 把所有不唯一的组合删除 delete from test where exists select 1 from test group by col1,col2 having count(*) >1
把所有不唯一的组合查出来 select col1,col2 from test group by col1,col2 having count(*) >1 把所有不唯一的组合删除 delete from test where exists select 1 from test group by col1,col2 having count(*) >1
select col1,col2 from test group by col1,col2 having count(*) >1
把所有不唯一的组合删除
delete from test where exists select 1 from test group by col1,col2 having count(*) >1
select col1,col2 from test group by col1,col2 having count(*) >1
把所有不唯一的组合删除
delete from test where exists select 1 from test group by col1,col2 having count(*) >1
col1 col2 col3 col4 ...... dddddd 3 1 t
ffffff 2 2 f
rrrrrr 2 2 g
tttttt 3 2 h
以 col2 和 col3 用distinct 形成具有主键功能的组合键
具体怎么写 SQL 语句
2.select distinct col2,col3 from tab
from tab
group by col2,col3