Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $query = "SELECT m.*,
- COUNT(*) AS goal_scored,
- p.first_name AS first_name,
- p.last_name AS last_name,
- p.id AS pid
- FROM `match` m
- LEFT JOIN goal g ON g.match_id = m.id
- LEFT JOIN player p ON g.player_marker_id = p.id
- WHERE m.round_id = :round_id
- AND (m.home_team_id = :team_id OR m.away_team_id = :team_id)
- GROUP BY m.id, g.id, first_name
- ORDER BY goal_scored DESC
- LIMIT 5";
- [
- {
- "id": "2565082",
- "round_id": "488",
- "datetime": "2018-05-10 00:15:00",
- "status": "5",
- "gameweek": "25",
- "home_team_id": "99",
- "home_team_half_time_score": "1",
- "home_team_score": "2",
- "home_extra_time": null,
- "home_penalties": null,
- "away_team_id": "95",
- "away_team_half_time_score": "1",
- "away_team_score": "2",
- "away_extra_time": null,
- "away_penalties": null,
- "venue_id": "573",
- "venue_attendance": "0",
- "aggregate_match_id": null,
- "goal_scored": "1",
- "first_name": "Brahian Milton",
- "last_name": "Alemán Athaydes",
- "pid": "91607"
- },
Add Comment
Please, Sign In to add comment