Yii Framework Forum: Criteria的Count 没有效果?why? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Criteria的Count 没有效果?why? Rate Topic: -----

#1 User is offline   straysh 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 19-September 12

Posted 22 February 2013 - 04:16 AM

			$criteria3 = NULL;
			$criteria3 = new CDbCriteria();
			$criteria3->compare('uid', $uid);
			$criteria3->select = 'uid, count(t.actiontype) as bb';
			$criteria3->group = 'actiontype';
			$criteria3->order = 'actiontype ASC';
			$criteria3->mergeWith($criteria);
			$model = new CActiveDataProvider('LoggerUser', array(
						'criteria'=>$criteria3,
					));


criteria 的写法如上,为什么count 没有效果? 返回的信息如下:
array
(
'uid' => '8'
'id' => null
'ip' => null
'actiontype' => null
'sub_class' => null
'old_state' => null
'new_state' => null
'c_time' => null
)

要怎么写才对呢
0

#2 User is offline   qq71151461 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 386
  • Joined: 05-June 09

Posted 26 February 2013 - 03:42 AM

给你的model 加上bb属性
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users