Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT m.id, m.round_id, m.datetime,
- CASE m.status
- WHEN 1 THEN 'scheduled'
- WHEN 2 THEN 'postponed'
- WHEN 3 THEN 'canceled'
- WHEN 4 THEN 'playing'
- WHEN 5 THEN 'finished'
- END AS match_status,
- m.gameweek, m.home_team_id, m.home_team_half_time_score, m.home_team_score,
- m.home_extra_time, m.home_penalties, m.away_team_id, m.away_team_half_time_score,
- m.away_team_score, m.away_extra_time, m.away_penalties, m.venue_id,
- m.venue_attendance, m.aggregate_match_id,
- t.name AS home_team_name,
- t_info.shield_link AS home_team_shield,
- t2.name AS away_team_name,
- t2_info.shield_link AS away_team_shield,
- c.name AS competition_name,
- c.id AS competition_id,
- r.name AS round_name
- FROM `match` m
- LEFT JOIN team t ON m.home_team_id = t.id
- LEFT JOIN team_info t_info ON t.id = t_info.team_id
- LEFT JOIN team t2 ON m.away_team_id = t2.id
- LEFT JOIN team_info t2_info ON t2.id = t2_info.team_id
- LEFT JOIN competition_rounds r ON m.round_id = r.id
- LEFT JOIN competition_seasons s ON r.season_id = s.id
- LEFT JOIN competition c ON c.id = s.competition_id
- WHERE 1 AND m.status IN (1, 2, 3, 4, 5) AND m.round_id IN (:round_id1) AND m.gameweek = (SELECT m2.gameweek
- FROM `match` m2
- ORDER BY (status < 5) DESC,
- (CASE WHEN status < 5 THEN gameweek END) ASC,
- gameweek DESC
- LIMIT 1
- ) ORDER BY m.datetime DESC LIMIT 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement