Skip to content

Instantly share code, notes, and snippets.

@harsha547
Created December 18, 2016 20:08
Show Gist options
  • Save harsha547/e649880608625fa2f9e15a281e075711 to your computer and use it in GitHub Desktop.
Save harsha547/e649880608625fa2f9e15a281e075711 to your computer and use it in GitHub Desktop.
Number of hosted matches season wise
-- Number of hosted matches season wise
SELECT
RANK() OVER ( ORDER BY Season.Season_Year ) As Season_Id,
Season.Season_Year ,
COUNT(*) As 'Hosted Matches'
FROM
Match
INNER JOIN
Season
ON
Match.Season_Id = Season.Season_Id
GROUP BY GROUPING SETS ( Season.Season_Year , ())
ORDER BY Season_Id
@harsha547
Copy link
Author

Result 👍

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment