title: Why did I sum the wrong result?
body: <p>I'd like to have an advice for this <code>SUM</code> that doesn't work as expected.
  I have to SUM data from the same day and display it in a table.
  I did a query like this:</p>
  <pre><code>SELECT * FROM giorni WHERE punto = '$punto' &amp;&amp; STR_TO_DATE(giorno, '%d/%m/%Y') BETWEEN   STR_TO_DATE('&quot; . $d1 . &quot;', '%d/%m/%Y') AND STR_TO_DATE('&quot; . $d2 . &quot;', '%d/%m/%Y') ORDER BY data&quot;;
  </code></pre>
  <p>This is the 'simple' one and it displays every single row, I have to put a SUM in it to make it show every day but <code>SUM</code> data from the same day.</p>
  <p>These 2 rows must be shown as one:
  <a href="https://i.stack.imgur.com/fKUnU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fKUnU.png" alt="enter image description here" /></a></p>
  <p>Can anyone give me any help to create this query?</p>