Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/06/2009, 15:26
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: SUM() a diferentes tablas ! ! !

Que valores esperas?

Prueba esto:

Código mysql:
Ver original
  1. Prueba esto:
  2. SELECT SUM(tr.resta) suma from
  3. (SELECT (TABLA1.importe - TABLA2.importe) resta
  4. FROM TABLA1 t1
  5. INNER JOIN TABLA2 t2
  6. ON t1.usr = t2.usr
  7. AND MONTH(t1.fecha) = 'x')tr;

Un saludo.
__________________
Without data, You are another person with an opinion.
W. Edwads Deming

Última edición por huesos52; 04/06/2009 a las 15:55