knoteva

09. Most Contributed Repositories

Oct 13th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.26 KB | None | 0 0
  1. SELECT TOP 5 r.Id, r.Name, COUNT(c.RepositoryId)
  2. FROM Repositories AS r
  3. LEFT JOIN Commits AS c ON r.Id = c.RepositoryId
  4. LEFT JOIN RepositoriesContributors AS rc ON r.Id = rc.RepositoryId
  5. GROUP BY r.Id, r.Name
  6. ORDER BY  COUNT(c.RepositoryId) DESC, r.Id, r.Name
Add Comment
Please, Sign In to add comment