Ver Mensaje Individual
  #10 (permalink)  
Antiguo 29/01/2011, 09:22
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años, 1 mes
Puntos: 300
Respuesta: mucha lentitud desde hace algunos dias

Entonces el problema no es el sum. ¿Y esto, te funciona? ¿Y si lo hace, cuánto tarda?
SELECT img.id, img.titulo, img.nombre_foto, img.tecnica, img.medidas FROM fotos img INNER JOIN (SELECT fot.id id, SUM(rate.puntaje) promedio, count(rate.puntaje) votos FROM fotos AS fot INNER JOIN puntuaciones AS rate ON fot.id = rate.id_foto GROUP BY fot.id ORDER BY promedio DESC, votos DESC LIMIT 3)t1 ON img.id= t1.id