mysql showing two select statements as one output 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]
You can combine them like this:

select 
    count(CASE WHEN sub like '%bar%' or comment like '%bar%' THEN postid ELSE NULL END) AS count_bar, 
    count(CASE WHEN sub like '%foo%' or comment like '%foo%' THEN postid ELSE NULL END) AS count_foo
from 
    myTable 
where 
    (sub like '%bar%' or comment like '%bar%'
     or sub like '%foo%' or comment like '%foo%') 
    and replies IS NOT NULL
group 
    by time div 3600 
order by 
    time div 3600 asc;


Note that I also change and replies IS NOT NULL, assuming you have rows that are actually NULL. With the quotes you used, you treated it as a string, but NULL is really nothing. You can't compare it like other datatypes, you have to use the special IS NULL or IS NOT NULL comparison.