Advertisement
Max_Leb

Untitled

Jan 29th, 2023
930
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.27 KB | None | 0 0
  1. SELECT c.ROWI AS contest_id, TEAMS.KIND AS kind,
  2. DENSE_RANK() OVER (PARTITION BY c.ROWI, TEAMS.KIND ORDER BY p.MARK DESC) AS res,
  3. TEAMS.ROWI AS team_id FROM CONTESTS c
  4. JOIN POINTS p, TEAMS ON p.CONTEST = c.ROWI AND p.TEAM  = TEAMS.ROWI
  5. ORDER BY contest_id, kind, res, team_id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement