Home > Database > Mysql Tutorial > body text

SQL query for the same value of a field

PHP中文网
Release: 2017-06-19 10:47:10
Original
2830 people have browsed it
sql query for the same value of a certain field:
SELECT * FROM table WHERE col in (SELECT col FROM table GROUP BY col HAVING COUNT (col) >1);
By the way, where and having:
select * from table
where ···(Only attributes before grouping can be filtered)
group by ···(Group by a certain field)
having ···(Only Filter the overall attributes of each group after grouping and use aggregate functions)
--If you don’t use group by, the entire table will be a group by default

The above is the detailed content of SQL query for the same value of a field. For more information, please follow other related articles on the PHP Chinese website!

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