I needed to get MAX valueid ID field. Problem was that "name" field appeared in the output and "maxID" did not, this is the code:
$criteria=new CDbCriteria;
$criteria->select = 'name, MAX(id) as maxID';
$last = Tree::model()->find($criteria);
echo $last->name; // this is working !
echo $last->maxID; // error, this field does not exists ! Property "??.maxID" is not defined.
After short time of seach an answer i solved that problem:
$criteria=new CDbCriteria;
$criteria->select = 'name, MAX(id) as id';
$last = Tree::model()->find($criteria);
echo $last->id;
some how id propertie already defined and this at last is overwritten
Does anybody knows what does this mean "Property "??.maxID" is not defined." ?