snowflake-cloud-data-platform - 雪花:加入两个选择语句
问题描述
免责声明:SQL 和 SNOWFLAKE的新手 ......所以在你从事反消费者滥用行为之前......
假设我有两个选择语句:
select foo,bar from baz as b;
select foo,bar,gee,whiz from qaz as q;
假设第二个 select 语句有一个连接:
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 行,pandas 占用超过 20gb 的内存。如何用 Snowflake 计算这个数据集?
解决方案
推荐阅读
- git - 通过 update-index 了解 git-filter-branch 的用法
- python - 使用 PyTorch 的测试集获取准确性时出错
- php - Sql select * from `categories` 内部连接 `category_product` on `categories`.`id`
- c++ - 为什么这个 cppreference 摘录似乎错误地暗示原子可以保护关键部分?
- matlab - 如何在 MATLAB 中求解包含符号的方程组?
- sql-server - SQL Server 机器学习服务 - 无法启动运行时。ErrorCode 0x80070032: 50(不支持该请求。)
- java - 使用 Neo4j 的休眠 OGM - 与服务器的应用程序连接失败
- flask - Flask 上 OAuth 的单元测试
- python - 为什么 OpenCV 会创建奇怪的矩形?
- node.js - multer上传带有正文和验证的文件并将文件名保存到数据库