= LEFT-JOIN {{tag>bbdd mysql}} select t1.fecha,t1.dia_semana,t1.tipo,t1.ubicacion,sum(t2.horas) as suma_horas from ct_anyo t1 left join ct_datos t2 on t1.fecha=t2.fecha where t2.id_usuario="1" AND year(t1.fecha)="2014" AND t1.Ubicacion="Barcelona" group by t1.fecha