当前位置:操作系统 > Unix/Linux >>

怎么样抽取重复记录

怎么样抽取重复记录
 
[A]select * from table t1 where where t1.rowed != 
(select max(rowed) from table t2 
where t1.id=t2.id and t1.name=t2.name) 
或者 
select count(*), t.col_a,t.col_b from table t 
group by col_a,col_b 
having count(*)>1 

 

 
如果想删除重复记录,可以把第一个语句的select替换为delete
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,