I want to get the percentage of sales for the month of the current year. In other words, I sum the total sales of the month of each month and I divide them by the total sales of the year.
SELECT
*,
sum(total_venta) as total_venta
FROM compra
GROUP BY MONTH(fecha_factura) /
(SELECT
sum(total_venta) * 100 as porcentaje
FROM compra)
But it's not coming out.