Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/07/2009, 15:29
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: Suma categorias sin repetir y por mes

Prueba esto:

Código sql:
Ver original
  1. SELECT categorias,SUM(gastos) FROM tabla1 INNER JOIN tabla2
  2. USING(id_categorias) WHERE date_format(fecha,'%Y-%m') = '2009-07'
  3. GROUP BY categorias;

No la he probado.
__________________
Without data, You are another person with an opinion.
W. Edwads Deming