Advertisement
Prohause

Untitled

Feb 16th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. SELECT TOP(5) c.Id, c.[Name] AS City, c.CountryCode AS Country, COUNT(a.Id) AS Accounts
  2. FROM Accounts AS a
  3. JOIN Cities AS c ON c.Id = a.CityId
  4. GROUP BY c.Id,c.[Name],c.CountryCode
  5. ORDER BY Accounts DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement