When I execute the following $criteria in a dataprovider for my CGridView
$criteria=new CDbCriteria;
$criteria->select='
player.id as p_id,
t.comment,
t.date_of_application,
currentdLeague.league_name as cl_league_name,
player.first_name as p_first_name,
player.last_name as p_last_name';
$criteria->join='LEFT JOIN (select player_id from tbl_player_season s where s.season_id='.SeasonLeague::model()->getCurrentSeasonID().') as slt on slt.player_id=t.player_id';
$criteria->with=array(
'player'=>array('joinType'=>'right join','select'=>false,),
'currentLeague'=>array('joinType'=>'left join','select'=>false,));
$criteria->compare('t.comment',$this->comment,true);
$criteria->compare('t.date_of_application',$this->date_of_application,true);
$criteria->compare('league.league_name',$this->cl_league_name,true);
$criteria->compare('player.first_name',$this->p_first_name,true);
$criteria->compare('player.last_name',$this->p_last_name,true);
$criteria->order='p_last_name asc, p_first_name asc';
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,));
I get the following SQL output
SELECT player.id as p_id, `t`.`comment` AS `t0_c2`, `t`.`date_of_application` AS `t0_c3`, currentLeague.league_name as cl_league_name, player.first_name as p_first_name, player.last_name as p_last_name, `t`.`season_id` AS `t0_c1`, `t`.`current_league_id` AS `t0_c4`, `t`.`player_id` AS `t0_c0` FROM `tbl_player_season` `t`
LEFT JOIN (select player_id from tbl_player_season s where s.season_id=2) as slt on slt.player_id=t.player_id
right join `tbl_player` `player` ON (`t`.`player_id`=`player`.`id`)
left join `tbl_league` `currentLeague` ON (`t`.`current_league_id`=`currentLeague`.`id`)
ORDER BY p_last_name asc, p_first_name asc LIMIT 10
When I execute this via MySQL workbench I get the expected results however my CGridView is returning with No Available Records. Has anyone experienced this?