消息:SQLSTATE [42S22]:未找到列:1054未知列'字段列表',查询为

时间:2014-12-04 12:42:43

标签: php mysql zend-framework

我在下面的函数中不断收到此错误,不知道我做错了什么,试图将单个逗号更改为double但仍然存在错误。请协助。

public function atAssessed($year, $month, $region)
 {
  $select = $this->select()
        ->from($this, array('COUNT(*) as assessed, MONTH(assd_date) as month'))
        ->where('assd = ?', 1)
        ->where('assd_date >= ?', ($year - 1) . '-' . ($month + 1) . '-01')
        ->group('MONTH(assd_date)')
        ->order('assd_date');
        ($region != 0 ? $select->where('region = ?', $region) : '');
  return $this->fetchAll($select);
 }

下方的完整错误消息
  

消息:SQLSTATE [42S22]:找不到列:1054未知列   在'字段列表'中'enterprise.COUNT(*)已评估,MONTH(assd_date)',   查询是:SELECT enterpriseCOUNT(*) as assessed, MONTH(assd_date) AS month FROM enterprise WHERE(assd = 1)AND   (assd_date> ='2013-13-01')GROUP BY MONTH(assd_date)ORDER BY   assd_date ASC

0 个答案:

没有答案