单表 单字段
查询 表C_COMPARERESULT
中c_tablename
字段内容是否有重复。
语法:SELECT TEST_NAME,COUNT(*) FROM T_TEST GROUP BY TEST_NAME HAVING COUNT(*) > 1
- T_TEST: 表名
- TEST_NAME: 列名
select c_tablename,COUNT(*) from C_COMPARERESULT group by c_tablename having count(*) >1 ;
单表 组合字段
语法: SELECT TEST_NAME1,TEST_NAME2,COUNT(*) FROM T_TEST GROUP BY TEST_NAME1,TEST_NAME2 HAVING COUNT(*) > 1
- T_TEST: 表名
- TEST_NAME1: 列名1
- TEST_NAME2: 列名2
示例:
select c_tablename,c_version,COUNT(*) from C_COMPARERESULT group by c_tablename,c_version having count(*) >1 ;