【问题标题】:hive sql query to select var between values we get from another sub select queryhive sql 查询在我们从另一个子选择查询获得的值之间选择 var
【发布时间】:2018-12-04 03:39:18
【问题描述】:

我想这样做

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

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

【问题讨论】:

    标签: sql hive bigdata hql


    【解决方案1】:

    你可以使用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
                 );
    

    【讨论】:

      猜你喜欢
      • 2012-12-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-04
      • 1970-01-01
      • 2012-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多