聚合函数与普通查询函数,要分开使用
select
(select min(price)from 表 t where price>190) as min,
(select max(price) from 表 t where price>190) as max,
price,
from 表 where price>190
聚合函数要用分组,
如果还有其他字段,就要在select后面也加上字段名,但是 group by 后面也要加上select后面有的字段(不包括聚合函数的字段)
select price,min(price),max(price)from 表
where price>190
group by price
语法没有错误,如:
select max(safetystocklevel), min(safetystocklevel) from production.product
where safetystocklevel>1
不过你要显示的结果描述的不是很清楚!
语句没什么问题啊,是不是逗号写成中文的了,报的是什么错呢
语句肯定是什么问题的。。。。看看是不是 哪里写错了。还有就是注意下price的数据类型。