Guest User

Untitled

a guest
Jun 24th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. $query = "SELECT m.*,
  2. COUNT(*) AS goal_scored,
  3. p.first_name AS first_name,
  4. p.last_name AS last_name,
  5. p.id AS pid
  6. FROM `match` m
  7. LEFT JOIN goal g ON g.match_id = m.id
  8. LEFT JOIN player p ON g.player_marker_id = p.id
  9. WHERE m.round_id = :round_id
  10. AND (m.home_team_id = :team_id OR m.away_team_id = :team_id)
  11. GROUP BY m.id, g.id, first_name
  12. ORDER BY goal_scored DESC
  13. LIMIT 5";
  14.  
  15. [
  16. {
  17. "id": "2565082",
  18. "round_id": "488",
  19. "datetime": "2018-05-10 00:15:00",
  20. "status": "5",
  21. "gameweek": "25",
  22. "home_team_id": "99",
  23. "home_team_half_time_score": "1",
  24. "home_team_score": "2",
  25. "home_extra_time": null,
  26. "home_penalties": null,
  27. "away_team_id": "95",
  28. "away_team_half_time_score": "1",
  29. "away_team_score": "2",
  30. "away_extra_time": null,
  31. "away_penalties": null,
  32. "venue_id": "573",
  33. "venue_attendance": "0",
  34. "aggregate_match_id": null,
  35. "goal_scored": "1",
  36. "first_name": "Brahian Milton",
  37. "last_name": "Alemán Athaydes",
  38. "pid": "91607"
  39. },
Add Comment
Please, Sign In to add comment