查询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
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
上一篇: Oracle数据类型的隐性转换
下一篇: mysql多表查询+分页如何实现最优?