SQL Having用法

--找出user_id重复的数据

	SELECT 
		MAX(id) AS max_id,
		user_id
	FROM
		tmp
	GROUP BY
		user_id
	HAVING
		COUNT(*) > 1

 

posted @ 2016-01-18 16:16  普贤  阅读(1684)  评论(0编辑  收藏  举报