title: Get Sum and sum of last 24 hours in a single query in mysql
body: <p>How to get total sum and sum of last day and count also in single query,</p>
  <p>here the sample data.</p>
  <pre><code>+----+-----------------+---------------------+
  | id | transfer_amount | addedon             |
  +----+-----------------+---------------------+
  |  1 |      50000.0000 | 2020-02-20 10:51:12 |
  |  2 |       2000.0000 | 2020-02-20 10:52:57 |
  |  3 |      10000.0000 | 2020-02-17 10:53:37 |
  |  4 |       7000.0000 | 2020-02-17 10:54:28 |
  |  5 |        500.0000 | 2020-02-17 10:55:07 |
  | 23 |       1000.0000 | 2020-02-19 17:37:06 |
  | 24 |       1000.0000 | 2020-02-19 17:41:12 |
  | 25 |       1000.0000 | 2020-02-19 17:46:48 |
  | 26 |       1000.0000 | 2020-02-19 17:47:17 |
  | 30 |       1000.0000 | 2020-02-19 17:58:38 |
  +----+-----------------+---------------------+
  </code></pre>
  <p>i tried to given query ,</p>
  <pre><code>select SUM(amount) as total_amount, COUNT('ALL') as total_count, 
      (select SUM(amount) from `transfers`WHERE date &gt; '2021-01-04 23:59:59' AND 
        date &lt;= '2021-01-05 23:59:59') as last_day_sum
  from `transfers`;
  </code></pre>
  <p>and result</p>
  <pre><code>+----------------+-------------+--------------+----------------+
  | total_amount   | total_count | last_day_sum | last_day_count |
  +----------------+-------------+--------------+----------------+
  | 314286380.0000 |       88452 |    1200.0000 |        0       |
  +----------------+-------------+--------------+----------------+
  </code></pre>
  <p>any other options for this ?</p>