CActiveDataProvider Select Property Working???

Hi,

as i have this in my code:




     $dataProvider=new CActiveDataProvider('Articelsets',array(                    

                    'criteria'=>array(                        

                        'select'=>'articelIdMaster.*',

                        'with'=>'articelIdMaster',

                        'distinct'=>true,

                        ),

                ));

		$this->render('showsets',array(                        

			'dataProvider'=>$dataProvider,

		));



I recieve this SQL-Stamtement at the page:




SELECT DISTINCT `t`.`articelsets_id` AS `t0_c0`, `t`.`articel_id_master` AS `t0_c1`, `t`.`articel_id_slave` AS `t0_c2`, `t`.`mandatory` AS `t0_c3`, `t`.`ars_amount` AS `t0_c4`, `articelIdMaster`.`article_id` AS `t1_c0`, `articelIdMaster`.`articelgroup_id` AS `t1_c1`, `articelIdMaster`.`art_number` AS `t1_c2`, `articelIdMaster`.`art_name_short` AS `t1_c3`, `articelIdMaster`.`art_name` AS `t1_c4`, `articelIdMaster`.`art_barcode` AS `t1_c5`, `articelIdMaster`.`art_weight` AS `t1_c6`, `articelIdMaster`.`art_length` AS `t1_c7`, `articelIdMaster`.`art_width` AS `t1_c8`, `articelIdMaster`.`art_height` AS `t1_c9`, `articelIdMaster`.`art_descr` AS `t1_c10`, `articelIdMaster`.`art_service_intervall` AS `t1_c11`, `articelIdMaster`.`art_price` AS `t1_c12`, `articelIdMaster`.`art_buyingdate` AS `t1_c13`, `articelIdMaster`.`art_afa_dauer` AS `t1_c14`, `articelIdMaster`.`art_deleted` AS `t1_c15`, `articelIdMaster`.`art_hasinsurance` AS `t1_c16`, `articelIdMaster`.`art_number_hist` AS `t1_c17`, `articelIdMaster`.`art_homepage` AS `t1_c18` FROM `tbl_articelsets` `t` LEFT OUTER JOIN `tbl_articel` `articelIdMaster` ON (`t`.`articel_id_master`=`articelIdMaster`.`article_id`) LIMIT 10



Why doesn’t yii take care about my select ;(

Thx and cheers Phil

The SQL statement contains several columns from articelIdMaster, e.g. "articelIdMaster.art_name AS t1_c4". So it obviously does, what it should. What did you expect?

As the select is placed:

all fields from "articelIdMaster" and none! of "t" Articelsets -> As I want it distinct over the fields from tbl_articel that are a master in tbl_articelset…

Thx for your support!

Ok, I solved it with a work around:




$Criteria = new CDbCriteria;

            $Criteria->join = 'INNER JOIN tbl_articelsets b on t.article_id = b.articel_id_master';

            $Criteria->distinct = true;



And changed the "master" table to Articel… -> solved it by INNER JOIN

Cheers Phil