Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/03/2013, 07:57
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 1 mes
Puntos: 574
Respuesta: Suma con dos tablas agrupado

Código MySQL:
Ver original
  1. SELECT t1.grupo0,IFNULL(sum(t2.unid0),0) totalgrupo0
  2. FROM tabla1 t1 left join tabla2 t2
  3. ON t1.id=t2.id0
  4. GROUP BY t1.grupo0;
__________________
Quim
--------------------------------------------------
Ayudar a ayudar es una buena práctica!!! Y da buenos resultados.