Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/10/2005, 09:43
Avatar de Jose_minglein2
Jose_minglein2
 
Fecha de Ingreso: noviembre-2004
Mensajes: 2.344
Antigüedad: 19 años, 5 meses
Puntos: 8
Tengo una solución para ti, pero hay un pequeño problema, bueno primero el codigo:
Código:
(SELECT country, COUNT(*) AS total FROM provider_id GROUP by country ORDER BY total DESC Limit 5 )
union
(
select 'otros' as country, count(*) as total from provider_id PI where
(select count(*) from  provider_id  where country=PI.country)<
(select count(*) as total from  provider_id group by country order by total desc limit 1)
)
Pero con esta hay un pequeñísimo problema y es que si por ejemplo, la posicion nº 6 y la nº 5 tienen el mismo count sólo aparecerá hasta la 5 (eso bien) pero en otros la posicion nº 6 no será contada.

Pero sigo investigando.