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

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

WBOY
WBOYOriginal
2016-06-07 17:46:461357browse


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

and

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


)
ORDER BY skid,upyear
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn