【发布时间】:2020-08-05 17:17:28
【问题描述】:
在 Postgres 中可以使用 Redshift 替代过滤器(在哪里...)? 我收到以下错误,无法确定这在 Redshift 中是不可能的还是我有语法错误: 数据库报语法错误:Amazon Invalid operation: syntax error at or near "(" Position: 1521;
select count(distinct "agent.id") as "agent_cnt"
, count(distinct "agent.id") filter (where "agent.status" = 'active' and ("agent.date" between '2020-01-01' and current_date)) as "active_agent_cnt"
from "agent"
【问题讨论】:
-
Redshift 在添加
filter(where)之前从 PostgreSQL 中分离出来。如果 Redshift 将此功能添加到他们的 fork 中,他们似乎会使用相同的语法,所以它可能不存在。
标签: sql filter amazon-redshift where-clause