Cactivedataprovider In Yii For Many To Many

I have an AR object "league".

league is many to many to player via league_has_player lt (which has lt.leauge_id and lt.player_id.

I have team is many to many to player via team_has_player

A third relation is team which is many to one to league (team has team.league_id)

I want all the players who are not on a team in the league.

In trying to setup my dataProvider for a GridView, I have tried this condition:


public function searchPlayerByLeagueNotOnTeam()

	{    

		$criteria=new CDbCriteria;

		$criteria->order = 't.last_name ASC';

                //$criteria->with = array('teams', 'players');

                $criteria->join = ', team ,player';

		$criteria->condition = 'player.id not in '

                        . '(select team_has_player.player_id '

                        . 'from team_has_player)';

		return new CActiveDataProvider('player', array(

			'criteria'=>$criteria,

		));

	}



But I get all the players multiple times.