timestamp类型以天为单位进行分组

这个为题的关键点在于转换timestamp类型成以填为单位的格式,然后进行分组,

<select id="getCountDataBytime" resultMap="CountData">
		SELECT  SUM(count_val_)  AS count_val_,SUM(total_money_) AS total_money_,end_time_
		FROM dt_hys_count
		where  start_time_>=#{startTime} and end_time_&lt;=#{endTime}
		GROUP BY  TO_DAYS(end_time_)
		order by  end_time_ asc
	</select>

猜你喜欢

转载自blog.csdn.net/qq_39091546/article/details/108521953