简体   繁体   中英

Trying to display the tutor names who salary is higher than the average salary

What I try to do is

SELECT tName, avg(Tutor.salary) AS avgSalary
FROM Tutor
GROUP BY tName
HAVING Tutor.salary > avgSalary;

Since your question is incomplete, I assume you have columns tName and salary in table Tutor . What you want to do is extract the average and then compare:

SELECT tName, salary FROM Tutor
WHERE
salary > (SELECT avg(salary) FROM Tutor);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM