I know, this is a stupid question, but I just can’t make it run.
The thing i want is: I got a table where entries from users are saved in and now I need a function to get all users (unique) with distinct. So every user just counts as "1" user.
The method i got at the moment looks as follows, but the distinct just doesn’t want to work.
public static function getAllVisitors()
{
$columns = array();
$columns[] = 'user_number';
$criteria = new CDbCriteria;
$criteria->select = $columns;
$count = self::model()->count($criteria);
return $count;
}
ObviouslyIn this case (not the implicit PK) the count() method don’t use the distinct property of the criteria. The count() method ignores the select criteria.
I probably would choose this workaround since it doesn’t need a column alias to be declared