Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT c.coach_name AS coach_name
- , dense_rank() OVER (partition BY c.coach_name ORDER BY m.playedAgainst) AS "match number"
- , m.playedAgainst AS MATCH
- , p.playerName AS player
- , p.salary AS salary
- -- , (sum(p.salary) - m.bets) AS profit
- FROM
- players_matches pm
- INNER JOIN matches m ON
- pm.fk_match = m.ROWID
- INNER JOIN players p ON
- pm.fk_player = p.ROWID
- INNER JOIN coaches c ON
- p.fk_coach = c.coach_name
- -- GROUP BY
- -- m.playedAgainst
- ORDER BY
- c.coach_name, m.playedAgainst
- ;
Add Comment
Please, Sign In to add comment