title: Join all columns in a while loop
body: <p>I have this loop:</p>
  
  <pre><code>BEGIN
    DECLARE time INT DEFAULT 1479154801;
  
    WHILE time &lt;= 1481756399 DO
     SELECT time;
     SELECT COUNT(*) FROM phpbb_posts WHERE post_time BETWEEN time AND (time+86400);
      SET time = time + 86400;
    END WHILE;
  END
  </code></pre>
  
  <p>Which work as I want it to, but results are not grouped and they look like this:</p>
  
  <pre><code>+------------+
  | time       |
  +------------+
  | 1479154801 |
  +------------+
  
  +----------+
  | COUNT(*) |
  +----------+
  |      746 |
  +----------+
  
  +------------+
  | time       |
  +------------+
  | 1479241201 |
  +------------+
  
  +----------+
  | COUNT(*) |
  +----------+
  |      652 |
  +----------+
  
  ...
  </code></pre>
  
  <p>When I want it to look like this:</p>
  
  <pre><code>+------------+----------+
  | time       | COUNT(*) |
  +------------+----------+
  | 1479154801 |      746 |
  | 1479241201 |      652 |
  ...
  </code></pre>
  
  <p>How can I do it? I'm a total newbie when it comes to SQL, so thank you very much for help.</p>