1.背景
需要将一段详细时间按天划分,每天多少次.
2.分析问题
MySQL数据库时间切割函数.
DATE_FORMAT(时间,'格式')
3.解决方案
<select id="selectThiefRecordmessage" parameterType="java.lang.Integer" resultMap="SelectBaseResultMap">SELECT count(1) num,operator_type,DATE_FORMAT(created,'%Y-%m-%d') AS createdFROM pm_thief_recordWHERE create_by = #{
createBy}GROUP BY created,operator_typeorder by created desc
</select>
4.问题解决
DATE_FORMAT(时间,‘格式’)有很多参数类型.