title: JOOQ How to select the min 'id' from a table
body: <p>In mysql I want to execute a query like this</p>
  
  <pre><code>SELECT MIN(id) FROM table;
  </code></pre>
  
  <p>The more I read about JOOQ syntax and the aggregate functions, the confused I get.</p>
  
  <p>I thought something like this would work</p>
  
  <pre><code>select( EVENT.EVENTID , min() ).from( EVENT ).fetch();
  or
  Result&lt;Integer&gt; er = context.select( EVENT.EVENTID.min()).fetch();
  </code></pre>
  
  <p>I tried a work around by selecting the whole first record</p>
  
  <pre><code>Result&lt;EventRecord&gt; er2 = context.selectFrom(EVENT).orderBy(EVENT.EVENTID.asc()).limit(1).fetch();
  </code></pre>
  
  <p>If the result has size 0, a record does not exist, but when it is not 0 I get the right record.  I would like to use the min() function but can't get the syntax right.</p>