【发布时间】:2020-11-30 01:40:48
【问题描述】:
编写一 (1) 个 MySQL 查询语句,返回在 该机构开展业务的每个州的过去一个月。结果应该从高到高排序 最低的平均售价。您的查询应返回以下格式的表 我试过了
select * from(
select avg(sale_price) from purchase where property_id = 64
union all (
select avg(sale_price) from purchase where property_id = 60)
union (
select avg(sale_price) from purchase where property_id = 58)) as i
order by sale_price ASC;
我收到此错误,因为我的表中有 sale_price 列
22:08:19 select * from( select avg(sale_price) from purchase where property_id = 64 union all ( select avg(sale_price) from purchase 其中 property_id = 60) union ( select avg(sale_price) from purchase 其中 property_id = 58)),因为我按 sale_price ASC LIMIT 0 订购, 1000 错误代码:1054. 'order' 中的未知列 'sale_price' 子句' 0.000 秒
【问题讨论】:
-
样本数据和预期结果将帮助您了解问题——以及其他任何愿意提供帮助的人。
-
你试过“按我订购”吗?
-
正如@RobMoll 所说,按1 订购