我可以在单个查询中运行这两个查询并将每个查询的结果数据存储在单独的列中吗?
select stars as Med
from business
where city = "Pittsburgh" and is_open = 1 and stars between 2 and 3
select stars as High
from business
where city = "Pittsburgh" and is_open = 1 and stars between 4 and 5
我尝试过:
select stars as Med
from business
where city = "Pittsburgh" and is_open = 1 and stars between 2 and 3
Union
select stars as High
from business
where city = "Pittsburgh" and is_open = 1 and stars between 4 and 5
但我只得到了“Med”专栏
+-----+
| med |
+-----+
| 2.0 |
| 2.5 |
| 3.0 |
| 4.0 |
| 4.5 |
| 5.0 |
+-----+