Mercurial > urweb
annotate tests/subquery.ur @ 1907:cb57ba73a61d
make uninstall: Uninstall types_cpp.h, urweb_cpp.h
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
author | Anders Kaseorg <andersk@mit.edu> |
---|---|
date | Fri, 22 Nov 2013 09:36:14 -0500 |
parents | 9c82548c97e9 |
children |
rev | line source |
---|---|
adamc@1191 | 1 table t : { A : int, B : int, C : int } |
adamc@1191 | 2 |
adamc@1191 | 3 fun main () = |
adamc@1191 | 4 v <- queryX1 (SELECT t.A, t.C |
adamc@1191 | 5 FROM t |
adamc@1191 | 6 WHERE t.B = (SELECT MAX(U.B) AS M |
adamc@1191 | 7 FROM t AS U |
adamc@1191 | 8 WHERE U.A = t.A)) |
adamc@1192 | 9 (fn r => <xml>{[r.A]},{[r.C]};</xml>); |
adamc@1192 | 10 v' <- queryX1 (SELECT t.A, t.C |
adamc@1192 | 11 FROM (SELECT t.A AS A, MAX(t.B) AS B |
adamc@1192 | 12 FROM t |
adamc@1192 | 13 GROUP BY t.A) AS Maxes |
adamc@1192 | 14 JOIN t ON t.A = Maxes.A AND t.B = Maxes.B) |
adamc@1192 | 15 (fn r => <xml>{[r.A]},{[r.C]};</xml>); |
adamc@1192 | 16 return <xml><body> |
adamc@1192 | 17 {v}<br/> |
adamc@1192 | 18 {v'} |
adamc@1192 | 19 </body></xml> |