I try to select only dog with weight superior to the average weight of all dogs.
I have this SQL query:
SELECT nameAni, weigth
FROM Animal
WHERE idTpAni IN (SELECT idTpAni
FROM TypeAnimal
WHERE libTpAni = 'DOG')
GROUP BY nameAni
HAVING AVG(weigth) < weigth;
If I tip 30 instead of AVG(weigth), I get the result I'm looking for.
Could you explain me why I have no result when typing "AVG(...)" ?