-- hours 0 - 23 create temporary table hours_t (h int, today int, yesterday int); insert into hours_t(h) values (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15), (16), (17), (18), (19), (20), (21), (22), (23); create temporary table today_t select h, count(distinct ip) c from ACCESS where DAY(dtime) = DAY(curdate()) group by h; create temporary table yesterday_t select h, count(distinct ip) c2 from ACCESS WHERE DAY(dtime) = DAY(date_sub(curdate(), interval 1 day)) group by h; plot all axislabels, very light blue bar, light red bar with no sides baroverlap 1 skinny comment left " Number of Visitors" title x "Hour of Day" legend bottom select hours_t.h, c2 as "Yesterday", c as "Today" from (hours_t LEFT JOIN today_t on hours_t.h = today_t.h) LEFT JOIN yesterday_t on hours_t.h = yesterday_t.h;