Skip to content
Advertisement

Range based window Frame can have only 1 sort key

Ive tried to run the next query

select sum(balance) over (partition by client order by card desc, date_tr desc)
from table_1

And in Result i have the next error message:

FAILED: SemanticException Range based Window Frame can have only 1 Sort key

Is it true, that i cant use 2 sort keys in order by sentence? Or there is a way how can i use 2 sort keys?

Advertisement

Answer

Your code should work. The language manual has a very similar example.

That said, an explicit window clause might get around the error:

select sum(balance) over (partition by client
                          order by card desc, date_tr desc
                          rows between unbounded preceding and current row
                         )
from table_1
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement