我面临一个从Grafana到Redshift的查询,在这里添加了一个特定的where子句,上面提到的错误即将出现。没有这个where条款,它做得很好。另外,如果我们将一个直接的值(比如first_week > 2 )放在其中,那么就不会出现错误。
其中条款:
WHERE first_week >= EXTRACT(YEAR FROM $__timeFrom AT TIME ZONE 'UTC')
from
(select a.distinct_id, a.login_week, b.first_week as first_week, a.login_week
first_week as week_number
from (select distinct_id, EXTRACT(WEEK FROM timestamp AT TIME ZONE 'UTC') AS login_week from posthog_event where distinct_id IN ( select distinct_id from activated_user) group by 1, 2) a,
select distinct_id, MIN(EXTRACT(WEEK FROM timestamp AT TIME ZONE 'UTC')) AS first_week from posthog_event where distinct_id IN ( select distinct_id from activated_user) group by 1) b
where a.distinct_id = b.distinct_id
) as with_week_number
where first_week>= EXTRACT(YEAR FROM '2022-03-01T17:01:18Z' AT TIME ZONE 'UTC')
group by first_week order by first_week知道我哪里出问题了吗?或者怎样才能添加where子句。
发布于 2022-09-01 18:05:19
https://grafana.com/grafana/plugins/grafana-redshift-datasource/
$__timeFrom()用引号输出面板范围的当前启动时间
=> Grafana宏是$__timeFrom(),而不仅仅是$__timeFrom,因此正确的条件:
WHERE first_week >= EXTRACT(YEAR FROM $__timeFrom() AT TIME ZONE 'UTC')和往常一样:医生是你的好朋友
https://stackoverflow.com/questions/73573150
复制相似问题