sai_rama
(sai rama)
June 22, 2011, 11:46am
1
hi all
i am trying to query a select distinct . The code i wrote is
$stud= Yii::app()->db->createCommand(array(
'select Distinct' => 'stud_number',
'from' => 'tbl_student',
))->queryColumn();
please help me
tri
(tri - Tommy Riboe)
June 22, 2011, 12:14pm
2
hi all
i am trying to query a select distinct . The code i wrote is
$stud= Yii::app()->db->createCommand(array(
'select Distinct' => 'stud_number',
'from' => 'tbl_student',
))->queryColumn();
please help me
Did you try to remove the space between select and Distinct ? API reference (see also constructor documentation). Perhaps even ‘distinct’=>true has to be added?
/Tommy
sai_rama
(sai rama)
June 23, 2011, 7:35am
3
Thank you tri
this is working
$stud= Yii::app()->db->createCommand(array(
'select' => 'stud_number',
'distinct' => 'true',
'from' => 'tbl_student',
))->queryColumn();