首页 > 解决方案 > 如何在sql中使用带有where条件的avg?

问题描述

我想选择高于平均价格的产品。这是我的 SQL:SELECT ProductName, Price FROM Products where Price >= AVG(Price);

它说平均值是错误的......任何人都可以帮助我吗?

这是我的数据库: 在此处输入图像描述

标签: sqlaveragewhere-clause

解决方案


试试看:

SELECT ProductName, Price
FROM Products
where Price >= (select avg(price) from Products)

推荐阅读