Having the following query template to select all:
val q = for {
a <- Parameters[Int]
b <- Parameters[Int]
t <- T if t.a == a && t.b == b
_ <- Query.orderBy(t.c, t.d)
} yield t
I need to modify it to select the very first (with minimum c
and d
minimum for this c
) or the very last (with maximum c
and d
maximum for this c
) record of those matching the where
condition. I'd usually strongly prefer no other (than the last/first) records to be selected as there are hundreds thousands of them...