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