雪花:加入两个选择语句

时间:2019-11-16 15:01:09

标签: snowflake-data-warehouse

免责声明:SQL和雪花的新手 ...因此在您从事反消费者滥用行为之前...

假设我有两个选择语句:

select foo,bar from baz as b;

select foo,bar,gee,whiz from qaz as q;

假设第二条选择语句具有联接:

select foo, bar, gee, whiz from qaz as q

left join data as d on (d.gee = q.gee)
where d.whiz = q.whiz
and q.foo is not NULL

现在,如何将这两个不同的选择组合到左联接中?

select foo,bar from baz as b
left join

( select foo, bar, gee, whiz from qaz as q
  left join data as d on (d.gee = q.gee)
  where d.whiz = q.whiz and q.foo is not NULL
) this

on b.foo = this.foo
where b.bar = this.bar
order by b.foo desc
limit 1 

以上操作无效。本地计算以上内容是不可能的:只有20,000行,熊猫获得了20GB以上的内存。如何使用Snowflake计算此数据集?

0 个答案:

没有答案
相关问题