amazon-redshift - Redshift - 将两个不同查询的输出相加到一个查询中
问题描述
我正在尝试对 Redshift 中 2 个不同 sql 的输出求和。
SQL1:
select count (*) from table1; -- Output : 10
SQL2:
select count (*) from table2; -- Output : 14
我正在尝试构建一个查询来显示这两个查询的总数。Expected output : 24
解决方案
想出了解决办法:
select ((select count(*) from table1) +
(select count(*) from table2)) as count
推荐阅读
- javascript - 将带有子变量的变量从 JQuery 传递到 Flask 应用程序
- python - 在 Python 中平均 pi 的位数
- r - 字符向量是否有 tidyr::extract 等效项?
- java - xp:fileUpload 的提交按钮需要完整更新吗?
- c++ - 自定义操作被另一个操作替换
- spring - Docker 容器未在浏览器上运行
- arrays - Int 数组在 c 中接受比声明大小多 1 个元素
- python - 保存到变量中时多行字符串不起作用
- vision - 如何通过 API 从我的 Google 相册中检索人物数据?
- c++ - 未使用计算的值,“如何解决警告”