title: sql how to select the lack of a condition?
body: <p>I have this table structure and data for keeping track of horse race results:</p>
  
  <pre><code>T_RACE_HISTORY
  ==============
  HORSE_ID   RACE_DT      PLACE
  --------   ----------   -----
         1   2014-05-03       1
         1   2014-07-22       1
         1   2016-06-10       3
         2   2016-06-10       2
         3   2016-06-10       1
  </code></pre>
  
  <p>I want a query that returns each unique horse id and either the date of the latest race won by that horse, or null if the horse has never won.</p>
  
  <p>In other words, I want a query with this output:</p>
  
  <pre><code>HORSE_ID    RACE_DT
  --------    ----------
         1    2014-07-22
         2    (null)
         3    2016-06-10
  </code></pre>
  
  <p>I can get the winning horses with a query like this:</p>
  
  <pre><code>SELECT     HORSE_ID,
             MAX(RACE_DT)
  FROM       T_RACE_HISTORY
  WHERE      PLACE = 1
  GROUP BY   HORSE_ID
  </code></pre>
  
  <p>But I have no idea how to look for the <em>lack</em> of any won races.</p>