mysql对分组数据根据名称去重后取最新的数据

	SELECT
	id,
	plan_person_name,
	plan_org_name,
	finish_survey_process,
	plan_theme,
	plan_ed_date,
	#取最新的那条数据
	MAX(plan_ed_date) date,
	#统计条数
	COUNT(1) num
	FROM bus_survey_record
GROUP BY
	plan_theme
	ORDER  by plan_ed_date DESC;

你可能感兴趣的:(mysql,数据库)