配置单元sql查询,用于在从另一个子选择查询获得的值之间选择var

mm9b1k5b  于 2021-06-27  发布在  Hive
关注(0)|答案(1)|浏览(382)

我想这么做

select x,y,z from table1 where x between (select a from table2) and (select b from table2);

这可能吗?如果是,怎么做?

6l7fqoea

6l7fqoea1#

你可以用 exists :

select t1.x, t1.y, t1.z
from table1 t1
where exists (select 1
              from table2 t2
              where t1.x between t2.a and t2.b
             );

相关问题