Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/09/2009, 05:19
gurthgor
 
Fecha de Ingreso: septiembre-2003
Mensajes: 65
Antigüedad: 20 años, 7 meses
Puntos: 1
Respuesta: consulta excluyente con fechas

Creo que con esto te valdria


SELECT SUM(Gastos-IF(cg.id_categoria_gastos=193,Gastos,0) ) AS totalgastos FROM employee e LEFT JOIN categoria_gastos cg ON e.id_categoria_gastos=cg.id_categoria_gastos WHERE Fecha BETWEEN '2009-06-01' AND '2009-06-31'