SQLize Online / PHPize Online

A A A
Share   Donate   Blog   Popular
Copy Format Clear
create table loginlog (log_date date, user varchar(64)); insert into loginlog values ('2013-07-08', 'Carl'), ('2013-07-09', 'Mark'), ('2013-07-09', 'Robert'), ('2013-08-09', 'Robert'), ('2013-08-09', 'Saul'), ('2013-09-09', 'Paula'), ('2014-01-09', 'Mark'), ('2014-02-09', 'Robert'); with recursive years(y) as ( select 2015 as y union all select y-1 as y from years where y > 2010 ) select y, user, count(*) from years rigth join loginlog on year(log_date) = y group by y, user;
Stuck with a problem? Need help? Ask professionals on our Telegram channel!
Join the channel
Your quersion is posted.
Join our Telegram channel and get answers.
Send
Copy