Reputation: 27
I have two columns that shows a list of account numbers and the month the account opened, like below:
Account Month
NEW021 Oct
EVA329 Nov
VEP005 Oct
CIT410 Dec
COE210 Oct
BAR023 Jan
HOW234 Jan
I need to create a query to sums up the total number of accounts opened for each month. So the results should come out like this:
Oct 3
Nov 2
Dec 1
Jan 2
Upvotes: 1
Views: 60
Reputation: 574
Select Month,
count(Account) as totalcounts from table
group by Month;
Upvotes: 3
Reputation: 2208
Select Month,count(Account) as cntOfaccounts from tableName
group by Month;
Upvotes: 1
Reputation: 4196
This is the principle:
select [Month], count(Account)
from t
group by [Month];
Upvotes: 1