Consider this query and its result:
Yii::app()->db->createCommand(
"SELECT name FROM users WHERE city='Paris'"
)->queryColumn();
Result:
Array
(
[0] => John Kerry
[1] => Marry White
[2] => Mike Jain
)
Any suggestions on how to build this query with ActiveRecord?
It is necessary to receive the array.
Duplicate:
Yii – How to get a values array from an Active Record
use
CHtml::listData(see http://www.yiiframework.com/wiki/48/by-example-chtml/#hh3 )It will give you array id => city