title: SELECT non duplicated rows with priority value
body: <p>I have a table that contains rows with measurements. For the same batch id, more than one measure can be specified. I want to get the correct values under the following conditions:</p>
  
  <ul>
  <li>If there is only one row for a given batch, the measure is valid</li>
  <li>If there is more than one row of the same type, the measure is NOT valid and the type returned should be 'Invalid', with value = 0</li>
  <li>If there is more than one row of different type (one 'Acquired' and one 'Verified'), the row returned must be the 'Verified' one</li>
  </ul>
  
  <p>Sample data:</p>
  
  <pre><code>create table measures (
    batch  int,
    type   varchar(24),
    value int
  );
  
  insert into measures select 01,'Verified',10;
  insert into measures select 02,'Acquired',34;
  insert into measures select 03,'Verified',22;
  insert into measures select 03,'Verified',24;
  insert into measures select 04,'Verified',32;
  insert into measures select 04,'Acquired',34;
  insert into measures select 05,'Acquired',42;
  insert into measures select 05,'Acquired',44;
  </code></pre>
  
  <p>Sample output:</p>
  
  <pre><code>01   Verified   10
  02   Acquired   34
  03   Invalid    0
  04   Verified   32
  05   Invalid    0
  </code></pre>