first record

What’s the best way to return just the first active record from a table?

What do you mean by "first"? The first in PK? Or just any record?

And what do you want to do with the retrieved first record?

what do you mean by first ? please explain it clearly.

$firstRecord = Model::model()->find();

You may supply a condition or ordering in which the first record will be returned.

You can also do it through SQL:

$firstRecord = Yii::app()->db->createCommand(‘SELECT * FROM {{model}}’)->queryScalar();

Ok.What i have is this a combo filled with a findAll method and a list that is filtered by the value(foreign) that is selected in the combo by ajax post.

Now what i want to do :

i want that when i load the page the list is filtered by the first value of the combo and not display all values.I will test the answer of rookie84