diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-06-02 16:47:09 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-06-02 16:47:09 -0400 |
commit | ecb92d9539880cc59a371c786af5312b833ff8ca (patch) | |
tree | 16d85bb575a9248e5c830e757a822240f8fa04ff /tests | |
parent | 6f28076613c975e382014cbcb074cbaa22fdf3e3 (diff) |
Partitioning and ordering for window functions
Diffstat (limited to 'tests')
-rw-r--r-- | tests/window.ur | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/window.ur b/tests/window.ur index fd93679c..dc338a43 100644 --- a/tests/window.ur +++ b/tests/window.ur @@ -3,9 +3,11 @@ table empsalary : { Depname : string, Salary : int } fun main () : transaction page = - x <- queryX (SELECT empsalary.Depname, empsalary.Empno, empsalary.Salary, RANK() AS R + x <- queryX (SELECT empsalary.Depname, empsalary.Empno, empsalary.Salary, + RANK() OVER (PARTITION BY empsalary.Depname ORDER BY empsalary.Salary DESC) AS R, + AVG(empsalary.Salary) OVER (PARTITION BY empsalary.Depname) AS A FROM empsalary) - (fn r => <xml>{[r.Empsalary.Depname]}, {[r.Empsalary.Empno]}, {[r.Empsalary.Salary]}, {[r.R]}<br/></xml>); + (fn r => <xml>{[r.Empsalary.Depname]}, {[r.Empsalary.Empno]}, {[r.Empsalary.Salary]}, {[r.R]}, {[r.A]}<br/></xml>); return <xml><body> {x} </body></xml> |