Sql查询语句过滤重复的数据

原创
2016/04/25 17:00
阅读数 5.5K

1、表中存在完全重复的数据,即所有字段内容都是相同的,或者所需要查询的字段完全重复

select distinct * from tablename;

2、表中存在部分数据重复的字段,即重复数据中至少有一个字段不重复

select * from t a where not exists 
(select 1 from where a.id = id a.name = name and a.length < length);

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
1
分享
返回顶部
顶部