Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/09/2007, 17:52
antionio
 
Fecha de Ingreso: septiembre-2007
Mensajes: 19
Antigüedad: 16 años, 7 meses
Puntos: 0
Re: 3 mejores clientes por año

la respuesta es
SELECT cliente, total, año
FROM TOTALES AS CTE
WHERE 3 > (
SELECT count( * )
FROM TOTALES
WHERE año = CTE.año
AND total > CTE.total )
ORDER BY año DESC , total DESC