1
I have this code, but what I want is the SELECT MIN
"n_rowers" and only the min number. I wanted the club with fewer rowers. Help? :)
SELECT (clube.nome) AS clube,
COUNT(remadores.cod_remador) AS n_remadores
FROM clube,
remadores
WHERE clube.cod_clube=remadores.cod_clube
GROUP BY clube.nome
HAVING COUNT(remadores.cod_remador) >= ALL
(SELECT COUNT(remadores.cod_remador) AS n_remadores
FROM clube,
remadores
WHERE clube.cod_clube= remadores.cod_clube
GROUP BY remadores.nome)
Which database ?: and what exactly do you want ? the sub query min ? or just the min of the result ?//
– Marco Souza
Mysql. I want the output min (n_rowers)
– Diogo Neves
you speak a line with the name of the club and the min of rowers.cod_rower ... or you are trying to get a line for each club with the min value of the sub query ?
– Marco Souza
SELECT (club.name) AS club, COUNT(rowers.cod_rower) AS n_rowers FROM club, rowers WHERE club.cod_club=rowers.cod_club GROUP BY club.name //I want the minimum result of this consultation!
– Diogo Neves
Which bd solution changes according to bd , top sqlserver, limit mysql , rownum oracle etc.
– Motta
phpMyAdmin, Mysql
– Diogo Neves