I need to know what I'm doing wrong. I have to get the total sales for the year 2014 where the payment date is 30 days. This is what I have.
SELECT MAX(fecha_orden), cantidad = COUNT(*)
FROM ventas
WHERE forma_pago = '30 días'
GROUP BY fecha_orden
It does not group me by the oldest year, but all of them appear.
Try the following:
to make the sum you have to occupy the sum for example:
And for the total sales of the year 2014 to appear where the payment date is 30 days, it could be with two conditions:
Remember as advice not to use neither ñ nor accents to avoid problems with the queries.