$sql = "select sum(字段名) as num,FROM_UNIXTIME(时间字段名,'%Y-%m-%d') as time from {{表名}} group by 时间字段 order by id desc limit 0,15";
$arr = Yii::app()->表名->createCommand($sql)->queryAll();
$sql = "select sum(字段名) as num,FROM_UNIXTIME(时间字段名,'%Y-%m-%d') as time from {{表名}} group by 时间字段 order by id desc limit 0,15";
$arr = Yii::app()->表名->createCommand($sql)->queryAll();
本文标题:sql 根据时间段 获取统计
本文链接:https://www.haomeiwen.com/subject/bcfyfxtx.html
网友评论