Reputation: 519
Get the Count of Contact's person by their title. (Table: Customers) below:
Now, below SQL code will get group counts, but I want to add also the names associated with each group if possible please:
SELECT ContactTitle, Count(ContactTitle) FROM Customers
GROUP BY ContactTitle;
Database: This is from NorthWind database.
Upvotes: 0
Views: 141
Reputation: 368
You can use
SELECT ContactTitle, ContactName, Count(ContactTitle) over (partition by ContactTitle) as usersCoun FROM Customers;
Upvotes: 1