SELECT ContactName, Country, COUNT(*) OVER (PARTITION BY Country) FROM Customers ORDER BY CountryThis will generate the same result as this query:
SELECT ContactName, Country, (SELECT COUNT(*) FROM Customers C1 WHERE C2.Country = C1.Country) FROM Customers C2 ORDER BY Country
No comments:
Post a Comment