SQLize Online / PHPize Online

Share      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? Got Error? Ask ChatGPT!
Copy Clear