view tests/window.ur @ 2235:0aae15c2a05a

Refactored a lot and fixed an and/or swap, but still not good on current test.
author Ziv Scully <ziv@mit.edu>
date Mon, 29 Jun 2015 01:33:47 -0700
parents 818d4097e2ed
children
line wrap: on
line source
table empsalary : { Depname : string,
                    Empno : int,
                    Salary : int }

fun main () : transaction page =
    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]}, {[r.A]}<br/></xml>);
    return <xml><body>
      {x}
    </body></xml>