$query= "SELECT * FROM games where games.league='".$receivedleague."' AND games.gamedate >='".$todaydate."' AND
'".$elnowla."' <= games.eldatetime AND (Not EXISTS(SELECT gameplayed.gameid,gameplayed.userid FROM gameplayed WHERE games.id=gameplayed.gameid AND gameplayed.userid='".$Userid."')) order by games.eldatetime asc limit 0,2" or die(mysql_error()) ;
Hello gurus !
Can anyone help me to improve this query below ? I am no experty in sql.
THe query does display what it is supposed to display, but the subquery takes too long.
Is there another way to make it more efficient ?
$query= "SELECT * FROM games where games.league='".$receivedleague."' AND games.gamedate >='".$todaydate."' AND
'".$elnowla."' <= games.eldatetime AND (Not EXISTS(SELECT gameplayed.gameid,gameplayed.userid FROM gameplayed WHERE games.id=gameplayed.gameid AND gameplayed.userid='".$Userid."')) order by games.eldatetime asc limit 0,2" or die(mysql_error()) ;
Any help would be appreciated. Thanks
Peter