当前位置:Gxlcms > mysql > 查询SQL表中某几个字段值有重复的记录

查询SQL表中某几个字段值有重复的记录

时间:2021-07-01 10:21:17 帮助过:11人阅读

SELECT *
FROM BXSK_Tab3
WHERE (skid IN
(
SELECT skid
FROM BXSK_Tab3
WHERE (upYear = 2008) AND (upMonth = 4)
GROUP BY skid
HAVING (COUNT(skid) > 1))

and

upyear
IN
(
SELECT upyear
FROM BXSK_Tab3
WHERE (upYear = 2008) AND (upMonth = 4)
GROUP BY upyear
HAVING (COUNT(upyear) > 1))


)
ORDER BY skid,upyear

人气教程排行