MySQL query using group by with multiple conditions
<p><strong>EDIT:</strong>
I have removed the confusing remark at the end and added an additional column pl_id which I thought irrelevant (due to my apparent lack of understanding the <code>group by</code> workings). When trying the suggestions posted, I ran into a problem where introducing the MAX/Group By would result in</p>

<pre><code>  | name  | license_plate | pl_id | start_date |
  | aaron | AA-AA-22      |     3 | 2016-1-1   |
</code></pre>

<p>Where i expected:</p>

<pre><code>  | name  | license_plate | pl_id | start_date |
  | aaron | AA-AA-22      |     4 | 2016-1-1   |
</code></pre>

<p>So somehow the max date for license plate AA-AA-22, which is 2016-1-1, appears in the record with pl_id = 3, why does the result return a record with the date from pl_id 4? 
<strong>END EDIT</strong></p>

<p>I have a table with columns:</p>

<ul>
<li>name</li>
<li>license_plate  </li>
<li>start_date</li>
</ul>

<p>I need a query that returns exactly one record for each license plate with the maximum start_date or where start_date is empty. But empty start_date should take precedence above maximum start_date. </p>

<p>Each license plate is guaranteed to have at most one entry with start_date = null but can have multiple entries with valid 'start_date'-s.</p>

<p>So for example, when executed on the following table:</p>

<pre><code>  | name  | license_plate | pl_id | start_date |
  | aaron | AA-AA-11      |     1 | 2015-1-1   |
  | aaron | AA-AA-11      |     2 | null       |
  | aaron | AA-AA-22      |     3 | 2015-1-1   |
  | aaron | AA-AA-22      |     4 | 2016-1-1   |
  | bill  | BB-BB-11      |     5 | 2015-1-1   |
  | bill  | BB-BB-11      |     6 | null       |
  | bill  | BB-BB-22      |     7 | 2015-1-1   |
  | clark | CC-CC-11      |     8 | 2015-1-1   |
  | clark | CC-CC-11      |     9 | 2016-1-1   |
  | dave  | DD-DD-11      |    10 | 2014-1-1   |
  | dave  | DD-DD-11      |    11 | 2015-1-1   |
  | dave  | DD-DD-11      |    12 | 2016-1-1   |
  | eddy  | EE-EE-11      |    13 | null       |
</code></pre>

<p>The query should return:</p>

<pre><code>  | name  | license_plate | pl_id | start_date |
  | aaron | AA-AA-11      |     2 | null       |
  | aaron | AA-AA-22      |     4 | 2016-1-1   |
  | bill  | BB-BB-11      |     6 | null       |
  | bill  | BB-BB-22      |     7 | 2015-1-1   |
  | clark | CC-CC-11      |     9 | 2016-1-1   |
  | dave  | DD-DD-11      |    12 | 2016-1-1   |
  | eddy  | EE-EE-11      |    13 | null       |
</code></pre>