SELECT qtty, date,@growth := @growth + qtty AS growth FROM (SELECT COUNT(*) AS qtty, SUBSTRING(created_at,1,10) AS date FROM users u JOIN(SELECT @growth :=0) g GROUP BY date ) q;
With this query you can calculate the growth of your `users` table per day based on a `created_at` field, with some modifications on the substring you can get the growth per months and per years.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.