0

我有一个每天运行的查询,并随着时间的推移返回一个列的计数器:

SELECT app_id, env, count(distinct session_id) as num_of_sessions, date(from_unixtime(timestamp/1000)) as st_date
FROM "etl_data_parquet"."sessions" 
where date(from_unixtime(timestamp/1000))>date_add('week', -3, CURRENT_DATE)
group by date(from_unixtime(timestamp/1000)), app_id, env
order by date(from_unixtime(timestamp/1000))

例子 我想添加另一个查询来显示每个日期的音量差异:所以我尝试做这样的事情(query_40 是原始查询):

select new_sessions_volume.num_of_sessions, old_sessions_volume.num_of_sessions
from query_40 as new_sessions_volume
inner join cached_query_40 as old_sessions_volume on query_40.st_date=cached_query_40.st_date

我试图加入包含旧数据和新查询结果的缓存表,然后减去它们,但我得到了这个错误:Error running query: no such column: query_40.st_date即使表确实有该列。

4

0 回答 0