【发布时间】:2015-09-23 03:05:04
【问题描述】:
我正在从 MySQL 迁移到 Postgres。在 MySQL 中我可以使用
select sum(clicks) c from table where event_date >= '1999-01-01'
group by keyword_id
having c > 10
Postgres 报错
错误:“c”列不存在
在 Postgres 中,我必须在 have 子句中重复该功能
select sum(clicks) c from table where event_date >= '1999-01-01'
group by keyword_id
having sum(clicks) > 10
代码中有很多地方需要更改。 Postgres 中是否有允许它在 having 子句中使用列别名的设置?
【问题讨论】:
标签: mysql sql postgresql