如何在 PostgreSQL 中创建命名窗口分区(别名)?
PostgreSQL 窗口函数 的文档似乎意味着您可以在查询中的多个位置使用相同的命名窗口。但是,我不知道如何创建命名窗口?
SELECT first_value(vin) OVER( PARTITION BY vin ) AS w, first_value(make) OVER w
FROM inventory.vehicles
WHERE lot_Id = 9999 AND make is not null;
这是一个笑话查询,我试图获取要采用的语法,但出现错误:
错误:窗口“w”不存在
The documentation for PostgreSQL window functions seems to imply you can use the same named window in multiple places in your query. However, I can't figure out how do I create a named window?
SELECT first_value(vin) OVER( PARTITION BY vin ) AS w, first_value(make) OVER w
FROM inventory.vehicles
WHERE lot_Id = 9999 AND make is not null;
This is a joke query I'm trying to get the syntax to take, but I'm getting error:
ERROR: window "w" does not exist
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案实际上在
SELECT
文档:这是一个示例,
The answer was actually in the
SELECT
doc:Here is an example,