title: SQL query for max time with group on string excluding groups with null time rows
body: <p>I know there are a lot of questions regarding using max with a group by <strike>but I promise this one is trickier.</strike> <em>(ok...so it was so easy it was answered in 10 minutes)</em></p>
  
  <p>Here's a sample table</p>
  
  <pre><code>|ID|name|     end_time     |
  |01|Bob |2012-02-09 3:00:00|
  |02|Bob |2012-02-09 3:15:00|
  |03|Ted |2012-02-09 3:00:00|
  |04|Ted |null              |
  </code></pre>
  
  <p>What I want is to return the max time grouped by name but exclude names that have a null end_time.</p>
  
  <p>I started with</p>
  
  <pre><code>SELECT * FROM table t,(
     SELECT MAX(end_time), name FROM table
     GROUP BY name
  ) last_entry
  WHERE t.name = last_entry.name
    AND t.end_time = last_entry.end_time
  </code></pre>
  
  <p>The problem is that this gives me ID 02 and 03 whereas I want it to return only 02.</p>