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

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

WBOY
Release: 2016-06-07 17:46:46
Original
1384 people have browsed it


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
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template