Hobby databasist here.
In my database, the statement below will output the number of posts per hour which discussed subject foo.
select
count(postid)
from
myTable
where
(sub like ("%foo%") or comment like ("%foo%"))
and replies != 'NULL'
group by
time div 3600
order by time div 3600 asc;
Output: [time div 3600, foo count]
this statement below would output the number of posts per hour which discussed subject bar.
select
count(postid)
from
myTable
where
(sub like ("%bar%") or comment like ("%bar%"))
and replies != 'NULL'
group
by time div 3600
order by
time div 3600 asc;
Output: [time div 3600, bar count]
How to I combine the output such that:
Output: [Time div 3600, foo count, bar count]
time div 3600
in theSELECT
? Or maybe(time div 3600) * 3600
, or evenFROM_UNIXTIME((time div 3600) * 3600)
??