Hi
Follow this tutorial statistical-query
class Post extends CActiveRecord
{
public function relations()
{
return array(
'commentCount'=>array(self::STAT, 'Comment', 'post_id'),
'categoryCount'=>array(
self::STAT, 'Category', 'post_category(post_id, category_id)'
),
);
}
}
Assuming table Comment have column created_date
In some case i want statistic some Comment have created_date from date to date.
So in my Criteria:
$criteria->addBetweenCondition('commentCount.created_date',$date_from,$date_to);
but i get this error 1054 Unknown column commentCount.created_date.
Can i add condition with relation STAT like relation HAS_MANY. Thanks