1、查询表某个列重复的数据量:
例如:找出重复的学号(XH)的信息
SELECT a.id, a.XH, a.XZBH, a.BYF, COUNT(1) AS c FROM `t_sdrs_xsxj` AS a GROUP BY XH HAVING c > 1;
2、查询表某个列去重后的数据集:
例如:去除重复的学号(XH)
SELECT * FROM t_sdrs_xsjbxx ORDER BY xh;
或者
SELECT DISTINCT xh,XM,XB FROM v_xs_jbxx;
3、去重复的数据,删除重复的数据留下一条
例如:
DELETE FROM user WHERE id NOT IN ( SELECT temp.min_id FROM ( SELECT MIN(id) min_id FROM user GROUP BY name,age )AS temp );
还有其他的去重方法。