用Group by分组后,取每组的前3条记录,怎么取?

  • 使用子查询进行查询
SELECT
	*
FROM
	home_content a
WHERE
	(
		SELECT
			count(id)
		FROM
			home_content
		WHERE
			class_link = a.class_link
		AND id > a.id
	) <= 2

posted on 2019-04-11 18:22  果然朝辉  阅读(4203)  评论(0编辑  收藏  举报

导航