title: SELECT a column not in GROUP BY clause
body: <p>I'm trying to write a query that would select only the rows that have events which where the only events in that year.</p>
  
  <p>Eg:</p>
  
  <pre><code>Year   Event
  2011     A
  2011     B
  2012     C
  2013     B
  2013     D
  2014     D
  </code></pre>
  
  <p>So, I would like to get the rows <code>2012   C</code> and <code>2014   D</code> in the results.
  I tried doing a <code>GROUP BY</code> on <code>Year</code>, but that wouldn't let me select the <code>Event</code> column.
  2011 and 2013 have 2 events, so these shouldn't be in the results.</p>
  
  <p>Please help.</p>
  
  <p>EDIT: I could write a nested query to get the only the rows having <code>count(Year) = 1</code> with <code>GROUP BY Year</code>, but I'm unable to get the <code>Event</code> column selected in the outer query</p>
  
  <pre><code>SELECT Year, Event from table where Year in (SELECT Year from table GROUP BY Year Having count(*) = 1) as count;
  </code></pre>