An Error Was Encountered

Error Number: 1213

Deadlock found when trying to get lock; try restarting transaction

CREATE TEMPORARY TABLE temp_players SELECT COUNT(DISTINCT f.id_fixture) AS pom, c.id_customer, c.firstname, c.surname, t.team_name, GROUP_CONCAT(DISTINCT t.team_name) AS teams, GROUP_CONCAT(DISTINCT t.id_team) AS id_teams FROM pi_fixtures f INNER JOIN pi_events e ON f.id_event = e.id_event INNER JOIN pi_rel_season s ON e.id_season = s.id_season INNER JOIN pi_customers c ON c.id_customer = f.id_manofthematch INNER JOIN pi_teams t ON c.id_team = t.id_team WHERE 1 AND s.id_season IN ('1010073','') AND s.id_league IN (1999854) GROUP BY COALESCE(c.id_customer_tc,f.id_manofthematch)