欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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

程序员文章站 2022-03-25 17:05:02
...
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