sql - hive sql 查询在我们从另一个子选择查询获得的值之间选择 var
问题描述
我想做这个
select x,y,z from table1 where x between (select a from table2) and (select b from table2);
这可能吗?如果是,如何?
解决方案
您可以使用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
);
推荐阅读
- pandas - 每组的活动时间差异
- c++ - 在带有 CLion 的 Mac 上使用 C++ 连接 MySQL 数据库时出现问题
- python - 添加可滚动画布时出现不需要的边框
- c# - c#枚举。获取像字符串一样的数值
- html - 将每个对象居中对齐
- apache-kafka - Quarkus 应用程序中 Kafka 反序列化器中的 CDI 上下文
- php - 显示适用于 SSMS 的 SQL Server 查询时 PHP 抛出错误
- angular - 使用 jsZIP 在一个 zip 文件夹中下载多个 csv 文件
- android - 尝试通过usb调试在android studio上运行应用程序时,有没有办法清除错误消息?
- amazon-web-services - 使用没有文件夹路径的cli上传到aws s3