问题描述
- 这段代码可以改写成group by...having语句吗?如果能,怎么改?
-
SELECT empfname, empsalary FROM qemp WHERE empsalary < (SELECT .90*AVG(empsalary) FROM qemp);
解决方案
SELECT empfname, empsalary FROM qemp GROUP BY empsalary HAVING empsalary > 90*AVG(empsalary);
解决方案二:
linq group by Having 语句的写法.
having和group by结合的使用
LINQ语句之Group By/Having和Exists/In/Any/All/Contains
解决方案三:
上面我写的也不对 应该是不能用groupby
解决方案四:
select empfname,empsalary from qemp
group by empsalary
having empsalary < .90*avg(empsalary)
解决方案五:
不能groupby在empfname上
SELECT 1 AS flg, empfname,empsalary
FROM qemp
GROUP BY flg
HAVNG empsalary < .90*avg(empsalary)
时间: 2024-10-23 16:42:23