我直接在 phpmyadmin 中运行这个查询,它完美地返回了结果!!但是当我在我的 php 脚本中运行这个查询时,它返回NULL
这是我的数据库类:
class Product extends Places_Db_Table_Row_Observable {
protected $_name = 'product';
PUBLIC function getMaxSubcatProduct()
{
$query = $this->getAdapter()->query("select max( c ) AS maxcount,id from ( select COUNT(*) as c
,product_sub_category_id as id from product group by product_sub_category_id ) as max ");
$res = $query->fetchAll();
return $res;
}
}