Ver Mensaje Individual
  #4  
Antiguo 28-08-2013
Avatar de fjcg02
[fjcg02] fjcg02 is offline
Miembro Premium
 
Registrado: dic 2003
Ubicación: Zamudio
Posts: 1.418
Reputación: 24
fjcg02 Va camino a la fama
Prueba con esto, en principio debería funcionar.

Código SQL [-]
SELECT
sum(importe) AS ventas_total, , 
sum(case when vendedor=1
             then importe
             else
                  0
      end ) AS VENDEDOR1,
year(fecha)*100+month(fecha) AS x_mes
FROM ventas 
GROUP BY year(fecha),month(fecha)

Nos dices cómo te ha ido. Si te va bien, nos explicas porqué.

Un saludo
__________________
Cuando los grillos cantan, es que es de noche - viejo proverbio chino -
Responder Con Cita