adamc@1191: table t : { A : int, B : int, C : int }
adamc@1191:
adamc@1191: fun main () =
adamc@1191: v <- queryX1 (SELECT t.A, t.C
adamc@1191: FROM t
adamc@1191: WHERE t.B = (SELECT MAX(U.B) AS M
adamc@1191: FROM t AS U
adamc@1191: WHERE U.A = t.A))
adamc@1192: (fn r => {[r.A]},{[r.C]};);
adamc@1192: v' <- queryX1 (SELECT t.A, t.C
adamc@1192: FROM (SELECT t.A AS A, MAX(t.B) AS B
adamc@1192: FROM t
adamc@1192: GROUP BY t.A) AS Maxes
adamc@1192: JOIN t ON t.A = Maxes.A AND t.B = Maxes.B)
adamc@1192: (fn r => {[r.A]},{[r.C]};);
adamc@1192: return
adamc@1192: {v}
adamc@1192: {v'}
adamc@1192: