Mercurial > urweb
comparison tests/group_by.ur @ 255:69d337f186eb
Monoized GROUP BY
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 31 Aug 2008 15:04:10 -0400 |
parents | 71bafe66dbe1 |
children | d1b679dbbc25 |
comparison
equal
deleted
inserted
replaced
254:f8d9395575ec | 255:69d337f186eb |
---|---|
7 val q3 = (SELECT * FROM t1 WHERE t1.A = 0 GROUP BY t1.B) | 7 val q3 = (SELECT * FROM t1 WHERE t1.A = 0 GROUP BY t1.B) |
8 val q4 = (SELECT * FROM t1 WHERE t1.A = 0 GROUP BY t1.C HAVING t1.C < 0.2) | 8 val q4 = (SELECT * FROM t1 WHERE t1.A = 0 GROUP BY t1.C HAVING t1.C < 0.2) |
9 | 9 |
10 val q5 = (SELECT t1.A, t2.D FROM t1, t2 GROUP BY t2.D, t1.A) | 10 val q5 = (SELECT t1.A, t2.D FROM t1, t2 GROUP BY t2.D, t1.A) |
11 val q6 = (SELECT t1.A, t2.D FROM t1, t2 WHERE t1.C = 0.0 GROUP BY t2.D, t1.A HAVING t1.A = t1.A AND t2.D = 17) | 11 val q6 = (SELECT t1.A, t2.D FROM t1, t2 WHERE t1.C = 0.0 GROUP BY t2.D, t1.A HAVING t1.A = t1.A AND t2.D = 17) |
12 | |
13 | |
14 datatype list a = Nil | Cons of a * list a | |
15 | |
16 val r1 : transaction (list {B : string}) = | |
17 query q1 | |
18 (fn fs acc => return (Cons (fs.T1, acc))) | |
19 Nil | |
20 | |
21 val r2 : transaction string = | |
22 ls <- r1; | |
23 return (case ls of | |
24 Nil => "Problem" | |
25 | Cons ({B = b, ...}, _) => b) | |
26 | |
27 val main : unit -> transaction page = fn () => | |
28 s <- r2; | |
29 return <html><body> | |
30 {cdata s} | |
31 </body></html> |