SQL. Average entries per month SQL. Average entries per month sql sql

SQL. Average entries per month


SELECT count(*) AS count, MONTH(date_column) as mnthFROM table_nameGROUP BY mnth

Should work for you

Edit:

SELECT AVG(a.count) AS avg FROM ( SELECT count(*) AS count, MONTH(date_column) as mnth       FROM table_name       GROUP BY mnth) AS a


try this out

SELECT COUNT(*)/COUNT(DISTINCT MONTH(`datefield`)) FROM tablename

No subqueries


hi using this query you will get the value

select avg(entry) as avgentrypermonth from (select month(DateCreated) as month ,count(1) as entry from table1 group by month(DateCreated))q1