SQL - un problemilla

 
Vista:

un problemilla

Publicado por xeltar (1 intervención) el 01/11/2002 10:35:32
Necesito especificar el continente con menos personas

Persona ( nombre, ciudad )
Ciudad ( ciudad, pais)
Pais ( pais, continente )
Continente ( continente )

Con esto encuentro cuantas personas hay en cada continente,
pero no se como buscar el continente con menos personas.

select P.continente as Continente, count (P.nombre) as cantidad
from Persona Per, Ciudad C, Pais P
where Per.ciudad = C.ciudad
and C.pais = P.pais
group by P.continente;
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:un problemilla

Publicado por Isaías Islas (5072 intervenciones) el 01/11/2002 17:04:21
Creo que es así

SET ROWCOUNT 1
select P.continente as Continente, count (P.nombre) as cantidad
from Persona Per, Ciudad C, Pais P
where Per.ciudad = C.ciudad
and C.pais = P.pais
group by P.continente
ORDER BY 2 DESC
SET ROWCOUNT 0

Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar