【发布时间】:2020-02-21 13:51:31
【问题描述】:
所以问题是我有三个结构相同的大表,我需要根据另一个查询的结果显示其中一个的结果。
所以我的订单表是这样的:
code order
A 0
B 2
C 1
我需要从t_results检索数据
我的方法(有效)如下所示:
select *
from t_results_a
where 'A' in (
select code
from t_order
where order = 0
)
UNION ALL
select *
from t_results_b
where 'B' in (
select code
from t_order
where order = 0
)
UNION ALL
select *
from t_results_c
where 'C' in (
select code
from t_order
where order = 0
)
是否有不扫描所有三个表的方法,因为我正在使用 Athena,所以我无法编程?
【问题讨论】:
标签: sql amazon-athena