select user_name,count(*) as count from user group by user_name having count>1; 上面语句的含义是:查询mysql数据库中user 表中user_name 有重复数据