I looked at a similar question and read the documentation on the average function, but when I tried:
CREATE TABLE tab(
id INT,
score INT
);
INSERT INTO tab VALUES
(1, 22),
(2, 45),
(3, 82),
(4, 87);
SELECT score,AVG(score)
FROM tab
GROUP BY score
HAVING score>AVG(score)
which puts AVG
after score
, I get
There are no results to be displayed.
How can I get this to work?
Here's the fiddle.