I have a database with buildings, with their names and heights. I want a query that gives me the names of the buildigs that differ less than 100 meters height from the average of all building.
I have tried:
SELECT Name FROM building
WHERE Height BETWEEN ABS((AVG(Height)) - 100) AND ABS(AVG(Height))
But it is not working, any ideas? :)
Have a subquery to get the average mountain height:
SELECT Name FROM mountain
WHERE (select AVG(Height) from mountain) BETWEEN Height - 100 and Height + 100
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With