一个sql语句:一个表test有四个字段id,a,b,c,如果表中的记录有三个字段a,b,c都相等,则说明这条记录是相同的,求相同的记录的个数 。
代码如下:
select a,b,c,count(*) from (select c.a,c.b,c.c from test c) having count(*) >= 2 group by a,b,c
或者
代码如下:
select zdbh,tdzl,zdmj,count(*) from ecaadmin.zdsx group by zdbh,tdzl,zdmj having count(*) >= 2
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