Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/01/2009, 09:00
chelodelsur
 
Fecha de Ingreso: abril-2008
Mensajes: 208
Antigüedad: 16 años
Puntos: 2
Respuesta: Select anidados???

Muchas gracias

aqui dejo como quedó la consulta, por si a alguien más le sirve el modelo. efectivamente tube que cambiar el alias, deje solo una fecha en el where de la consulta principal.

Código:
Select
  distinct a.agente_evaluado AGENTE,
  Year(Fecha_evaluacion) as 'Año',
  SUM(IF(ID_LLAMADA>0,1,0))`CANT EVALUACIONES`,
    (select 
    count(b.id_notas)
    from evaluaciones d
    inner join notas_evaluaciones b
    on d.id_evaluacion = b.id_evaluacion
    where (d.identifica_cliente='1'OR d.escucha_activa='1' OR d.asesorar='1'
    OR d.conocimiento_producto='1' OR d.procedimientos='1' OR d.ingreso_datos='1')
    and d.agente_evaluado=a.agente_evaluado) as 'ev con errores',
  sum(b.errores_fatales) as `T ERRORES FATALES`,
  format(avg(b.NOTA_AREA_1),1) `ESTILO MANEJO LLAMADA`,
  format(avg(b.NOTA_AREA_2),1) `ESTRUCTURA / HABILIDADES`,
  format(avg(b.NOTA_AREA_3),1) `EFICIENCIA / CONOCIMIENTO`,
  format(avg(b.NOTA_EVALUACION),1) `NOTA FINAL`
FROM evaluaciones a
INNER JOIN notas_evaluaciones b
ON a.id_evaluacion = b.id_evaluacion
where a.fecha_evaluacion between '2008/01/01' and  '2008/12/31'
And agente_evaluado like'%' 
GROUP BY agente,'AÑO'
ORDER BY `agente_evaluado` asc, fecha_evaluacion asc;
Como siempre muchas gracias