Deseo ordenar las ultimas ventas con pago de 30 y 60 dias y ordenar por fecha orden
SELECT almacen_id, MAX(fecha_orden) as fecha, forma_pago FROM ventas WHERE forma_pago = '60 días' OR forma_pago = '30 días' GROUP BY fecha_orden
Tengo el error: Msg 8120, Level 16, State 1, Line 3 Column 'ventas.almacen_id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.