We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doris-2.1.6-rc04-653e315ba5
mysql> with t0 as ( select 1 id, 2 val, 0 sort UNION ALL select 1, 3, 1 union all select 1, 4, 2 union all select 2, 1, 0 union all select 2, 7, 1 ) , t1 as ( select id, sum(val) over( partition by id order by sort rows between UNBOUNDED PRECEDING and current row ) calc, ROW_NUMBER() over(partition by id order by sort desc ) rn from t0 ) select * from t1 ; +----+------+----+ | id | calc | rn | +----+------+----+ | 1 | 9 | 1 | | 1 | 5 | 2 | | 1 | 2 | 3 | | 2 | 8 | 1 | | 2 | 1 | 2 | +----+------+----+ -- add where rn=1 mysql> with t0 as ( select 1 id, 2 val, 0 sort UNION ALL select 1, 3, 1 union all select 1, 4, 2 union all select 2, 1, 0 union all select 2, 7, 1 ) , t1 as ( select id, sum(val) over( partition by id order by sort rows between UNBOUNDED PRECEDING and current row ) calc, ROW_NUMBER() over(partition by id order by sort desc ) rn from t0 ) select * from t1 where rn = 1; +----+------+----+ | id | calc | rn | +----+------+----+ | 1 | 4 | 1 | | 2 | 7 | 1 | +----+------+----+
add where rn=1, the result has error.
the correct result should be:
+----+------+----+ | id | calc | rn | +----+------+----+ | 1 | 9 | 1 | | 2 | 8 | 1 | +----+------+----+
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Search before asking
Version
doris-2.1.6-rc04-653e315ba5
What's Wrong?
add where rn=1, the result has error.
What You Expected?
the correct result should be:
How to Reproduce?
No response
Anything Else?
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: