I have tried to find some kind of query that does arithmetic operations to show them in a table only the result. I've tried with count()
but I only get the data and not the operations, such as adding and multiplying the sales.
For example, from sale 1 I have 3 different items get the summation and if I had more than 1 unit also multiplication, some subject that I recommend read to do so? so far I only achieve it by going through the vector that returns the query and doing the operations with php functions,
The query is normal:
SELECT * Fecha FROM 'ventas';
What is not done is how to make the summation of all the data. When I apply count
and sum
I only return the value of for example, sale 1 and not all sales.
The query that only returns my sales number but not the sum of the items sold, is where I'm stuck
SELECT NoVenta, COUNT(*) FROM ventas GROUP by NoVenta
<table>
<tr>
<th>No. Venta</th>
<th>Total</th>
</tr>
<tr>
<td>1</td>
<td>550</td>
</tr>
<tr>
<td>2</td>
<td>700</td>
</tr>
<tr>
<td>3</td>
<td>800</td>
</tr>
<tr>
<td>4</td>
<td>900</td>
</tr>
<tr>
<td>5</td>
<td>600</td>
</tr>
<tr>
<td>6</td>
<td>500</td>
</tr>
</table>