title: Get SUM of row WHERE date equal
body: <p>I am not able to execute the code when doing the SUM of row WHERE date equal to a given date in PHP PDO.
  In my case, it calculates all values without considering the date.</p>
  <p>MY Code is -</p>
  <pre><code>$stmt = $con-&gt;prepare(&quot;SELECT SUM(`sales_amt`) AS `amazonSales` FROM `sales` WHERE `channel_name` = :channel1 AND `channel_name` = :channel2 AND `inv_date` = :selecteddate&quot;);
  $stmt-&gt;execute(array(':channel1' =&gt; 'AMAZON_FBA', ':channel2' =&gt; 'AMAZON_IN', ':selecteddate' =&gt; '05-09-2020'));
  while ($result = $stmt-&gt;fetch(PDO::FETCH_ASSOC)) {
     $amazonSales = $result['amazonSales'];
  }
  </code></pre>
  <p>DATABASE Table as <code>sales</code></p>
  <pre><code>---------------------------------------------------
  ID   | channel_name  |  sales_amt  |  inv_date    |
  ---------------------------------------------------
  1    | AMAZON_IN     | 10          | 05-09-2020   |
  2    | AMAZON_FBA    | 30          | 05-09-2020   |
  3    | AMAZON_IN     | 20          | 04-09-2020   |
  4    | AMAZON_FBA    | 40          | 05-09-2020   |
  5    | AMAZON_IN     | 50          | 03-09-2020   |
  ---------------------------------------------------
  </code></pre>
  <p>I want its output to show <code>80</code> same as the issue while fetching total rows also.
  Please, help me how to fix this issue and why it comes...</p>