$field = "count(id) as num,FROM_UNIXTIME(uptime,'%Y') as y,FROM_UNIXTIME(uptime,'%m') as m,FROM_UNIXTIME(uptime,'%Y年%m月') as t";
$list = $this->content_model->field($field)->group('t')->order('t desc')->select();
提示错误SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') as m,'%Y年%m月') as t FROM `hl_content` GROUP BY t ORDER BY t desc' at line 1
到数据库中执行OK的:SELECT count(id) as num,FROM_UNIXTIME(uptime,'%Y') as y,FROM_UNIXTIME(uptime,'%m') as m,FROM_UNIXTIME(uptime,'%Y年%m月') as t
FROM hl_content
GROUP BY t
ORDER BY t DESC

最佳答案
