summaryrefslogtreecommitdiff
path: root/tests/window.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-06-02 16:47:09 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-06-02 16:47:09 -0400
commit858481a426ea3873440c3bed30eb563f8cf3480e (patch)
tree16d85bb575a9248e5c830e757a822240f8fa04ff /tests/window.ur
parent8b6941ac380392e36a30a06fb558c47a8fe7d2d8 (diff)
Partitioning and ordering for window functions
Diffstat (limited to 'tests/window.ur')
-rw-r--r--tests/window.ur6
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>