SQL中查找某字段值重复或多个字段值重复的记录数
更新:HHH   时间:2023-1-7


只筛选一个字段值相同的记录

select * from A where PDDT in(
    select PDDT FROM A 
    group by PDDT
    having count(PDDT)>1
)

筛选多个字段值相同的的记录

SELECT COUNT(*),DeptID, PDDT , DLNo , DLNoRe, MacNo
    FROM A
    GROUP BY DeptID, PDDT , DLNo , DLNoRe, MacNo
    having count(*)>1
返回数据库教程...