sql 匹配字段中开头统计数据

select SUM(INCREASED_TOURIST_COUNT) sumres,left(CUR_HOUR,10) day from MEAS_HOURLY_TOURISTS 

<dynamic prepend="WHERE">

<isNotEmpty prepend="AND" property="scenic_area_code">

scenic_area_code = #scenic_area_code#

</isNotEmpty>

</dynamic>

group by day order by sumres desc limit 0,1

 

 

字段 :

2014-05-02 3:00  

2014-05-02 4:00  

2014-06-02 3:00  

按天统计,使用left

 

 

你可能感兴趣的:(统计数据)