使用多个表创建表
我正在尝试从多个表创建一个表。
我正在尝试下面,但要遇到错误:
Create or replace tablec as
select
Count(id) as total
from table a,
select count(ref) as ref_total
from table b
我所需的输出应如下所示,应按日期进行过滤。
I'm trying to create a table from multiple tables.
table a has list of IDs and I need count of IDs stored in table C.
Table b has list of IDs and need the count of them as well in table C.
I'm trying below but getting an error:
Create or replace tablec as
select
Count(id) as total
from table a,
select count(ref) as ref_total
from table b
My desired output should look like below and should be filter applied by date.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑为每个计数使用一个子查询如下所示。
输出:
我认为您可以添加 date eftert 每个子查询的条款出于您的目的。
Consider using a subquery for each count like below.
output:
I think you can add date filter in WHERE clause of each subquery for your purpose.