title: SUM values - output error when de sum is equal to zero
body: <p>With the following query I get the sum of the sales value per year for each country in the database</p>
  
  <pre><code>   $country_parameter = $_REQUEST['parameter'];
  
     $query = "SELECT YEAR(sl.year_sales) AS year,
                         COALESCE(SUM(sl.value_sales),0) AS value
                         FROM sales sl LEFT JOIN country co
                         ON sl.id_country = co.id_country
                         WHERE parameter = ?
                         GROUP BY year
                         ORDER BY year";
  
      if($statement = $conexao-&gt;prepare($query)){
          $statement-&gt;bind_param("i", $country_parameter );
          $statement-&gt;execute();
  
          $result = $statement -&gt;get_result();
  
          while($data = $result-&gt;fetch_assoc()){
              $output[] = $data;
          }
  
          echo json_encode($output);
  
      $conexao-&gt;close();
  </code></pre>
  
  <p>Problem: when there are no sales and the sum is equal to zero, on the client side the output returns only <strong>null</strong> and I get de error <em>Uncaught TypeError: Cannot read property 'metaData' of null</em></p>
  
  <p>EDITED:</p>
  
  <p>If value the output is:</p>
  
  <pre><code>[{"year":2017,"value":11600}]
  </code></pre>
  
  <p>If not output is just:</p>
  
  <pre><code>null
  </code></pre>
  
  <p>If I query the database directly the result is: </p>
  
  <p>year:</p>
  
  <p>value:</p>
  
  <p>Is the year supposed to always return a result and the value equal zero?</p>
  
  <p>year: 2016</p>
  
  <p>value: 0</p>