shulinqian 2012-02-14 14:38:54 2923次浏览 3条回复 0 0 0

我就只想知道

SELECT *,COUNT(*) AS nums FROM log GROUP BY `cid`;

这样的语句怎么处理,都没有人知道吗?

$criteria = new CDbCriteria();
$criteria->group = "bot";
$criteria->select = "*, COUNT(`cid`)  AS nums";
$criteria->params = "";
$test = Log::model()->findAll($criteria);      
foreach ($test as $value) {
    echo '<pre>';
    print_r($value->nums);
    echo '</pre>';
}

sql正常,但总提示nums未定义。

您需要登录后才可以回复。登录 | 立即注册