Sql查询数据表中的重复纪录(轉)
要查询案卷表中的重复纪录,比如是否有单位重复的纪录,可以使用下列的方法
SELECT *
FROM jkarchvol
WHERE (vol_unit IN
(SELECT vol_unit
FROM jkarchvol
GROUP BY vol_unit
HAVING COUNT(*) > 1))
做的时候出现多个字段重复纪录查询的情况,更改上面语句
select * from jkarchvol b, (select vol_unit,limited from jkarchvol group by vol_unit,limited having count(*)>1) a where b.vol_unit = a.vol_unit or b.limited = a.limited