首页 > 技术文章 > Mysql查询某字段值重复的数据

anxiaoyu 2018-03-24 10:01 原文

select accountid,count(*) as count from vtiger_assetaccount  group by accountid having count>1;

 更新

如果要找出是哪些记录重复

SELECT
	result.accountid
FROM
	(
		SELECT
			accountid,
			count(*) AS count
		FROM
			vtiger_assetaccount
		GROUP BY
			accountid
		HAVING
			count > 1
	) AS result
LEFT JOIN vtiger_assetaccount ON vtiger_assetaccount.accountid = result.accountid

 

推荐阅读