干货 查询 tb_host 表中 端口号(port)是否重复 SELECT port, COUNT(*) FROM tb_host GROUP BY port HAVING count(port) > 1; result port | count ------+------- 22 | 3 (1 row)