Amazon Athena中的Sequence函数

huangapple go评论65阅读模式
英文:

Sequence function in Amazon Athena

问题

我无法使用Amazon Athena的序列函数。它显示语法错误,提示:不是窗口函数:sequence。

我编写了以下代码:
从<table_name>中选择sequence(1, 1) OVER () as seq_num

英文:

I am not able to use the sequence function amazon athena.
It shows a syntax error saying : Not a window function: sequence

I wrote the following code :
SELECT sequence(1, 1) OVER () as seq_num
FROM <table_name>

答案1

得分: 1

你可以考虑使用 ROW_NUMBER()。你可以选择使用:

SELECT * FROM UNNEST(sequence(1, 5))

或者

SELECT ROW_NUMBER() OVER() as seq_num FROM campaign_lookup

英文:

You might want to use ROW_NUMBER(). You can either use:

SELECT * FROM UNNEST(sequence(1, 5))

or

SELECT ROW_NUMBER() OVER() as seq_num FROM campaign_lookup

huangapple
  • 本文由 发表于 2023年2月8日 13:42:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75381752.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定