I have a below query
SELECT COUNT( DISTINCT id ) AS `total` , YEAR( created_date ) AS `memberYear`
FROM `users` AS `u`
WHERE (
role_id =2
AND is_deleted =0
AND is_trashed =0
)
GROUP BY `memberYear`
With this query i am getting record like this
total memberYear
10 2012
12 2013
2 2014
Now i need to get record total sum with previous year
total memberYear sumTotal
10 2012 10
12 2013 22
2 2014 24
How can i get this sum of Total ? Any help will be appreciated.