Yii cdbcriteria select a relation's columns

I am having very difficult time to select usernames of all posts in the blog demo given in Yii…

author is relation of post class with user…

$criteria = new CDbCriteria;

$criteria->with=‘author’;

$criteria->distinct=true;

$criteria->select=‘author_id,author.username’;

$dataProvider=new CActiveDataProvider(‘Post’, array(

‘criteria’ => $criteria,

));

var_dump($dataProvider->getData());

Error:

Active record "Post" is trying to select an invalid column "author.username". Note, the column must exist in the table or be an expression with alias.

Please plese someone help me…its urgent…

I had same problem,

look here Select problem CDbCriteria with join and select

I think correct is

$criteria->with = array("author"=>array("select"=>"id,username"));

Thanks! You save me a lot of time!!!

total life saver!!!!! Thanks!

Helpful… thanks