Here’s some SQL queries to get you started:
—- Aggregated Report —-
SELECT
u.ID AS User_ID,
u.display_name AS User_Name,
l.name AS League,
u.user_email AS User_Email,
IFNULL(COUNT(p.user_id), 0) AS Nr_of_predictions,
SUM(p.has_joker) AS JOKER_VALUE
FROM wp_users u
LEFT OUTER JOIN pool_wp_predictions p ON ( u.ID = p.user_id )
JOIN pool_wp_league_users lu ON ( lu.user_id = u.id )
JOIN pool_wp_leagues l ON ( l.id = lu.league_id )
GROUP BY u.id
ORDER BY u.id
;
—- Detailed report —-
SELECT
p.user_id AS User_ID,
u.display_name AS User_Name,
l.name AS League,
u.user_email AS User_Email,
p.match_id AS Match_ID,
t.name AS Home_Team,
p.home_score AS Home_Team_Score_Prediction,
t1.name AS Away_Team,
p.away_score AS Away_Team_Score_Prediction,
p.has_joker AS Joker_Match
FROM pool_wp_predictions p
JOIN wp_users u ON ( u.ID = p.user_id )
JOIN pool_wp_matches m ON ( m.id = p.match_id )
JOIN pool_wp_teams t ON ( t.id = m.home_team_id )
JOIN pool_wp_teams t1 ON ( t1.id = m.away_team_id )
JOIN pool_wp_league_users lu ON ( lu.user_id = u.id )
JOIN pool_wp_leagues l ON ( l.id = lu.league_id )
Order by p.match_id
;