Unknown table 'team_view' in where clause select first_name, surname, user_id, email from users u, team_user_match m where rank >= 10 and team_id = team_view.php and usersid = user_id