mysql - Get a monthly summary -


i have database table contains column represents initial subscription date. want query number of records exists between 2 specific dates grouping months , years. may me please. example of such table.

create table objects( id int primary key, subscription_date date, ) 

i want example count objects exists each month 12/12/2011 till 12/12/2013 knowing objects counted before must counted again in next month since still exist, , new objects subscribed in new dates added up.

for month can try this:-

select count(val)  objects group month(subscription_date); 

and year can try this:-

select count(val)  objects group year(subscription_date); 

hope can you.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -