title: How to get First and Last record from a sql query?
body: <p>In PostgreSQL I run a query on it with several conditions that returns multiple rows, ordered by one of the columns. Example:</p>
  <pre><code>SELECT &lt;some columns&gt; 
  FROM mytable
  &lt;maybe some joins here&gt;
  WHERE &lt;various conditions&gt;
  ORDER BY date DESC
  </code></pre>
  <p>How would one get the first and the last row from this query?</p>