Have a complicated question to ask: I have a table with 5000 rows and lists state and branch number. I am trying to run a count function (which I created as another query because didn't think I could do both in the same query) where it totals the amount of branches in each state. Which is showing me the top branches that sold insurance products.
However I am trying to pull 2 results for every state (State is listed as numerical number 1-50), so theoretically this should show 100 results listed and rank them only to pull the top 2 states/branches that sold the most insurance. Is this Possible?
Code:
SELECT a.STATE, Count(a.Branch) AS Branch Totals FROM [January Population] a GROUP BY a.STATE;
Comment