title: when duplicates found keep row if cell is a certain value
body: <p>I have a query that returns this result.  How do I write the query to     say, the if email is the same, only return the row where IsActive = 1?</p>
  <pre><code>SubID = Unique
  
  | SubID | EMail | IsActive |
  | -------------- | -------------- | -------------- |
  | 123 | hello@acme.com            | 1 |
  | 456 | hello@acme.com            | 0 |
  | 789 | hi@acme.com               | 1 |
  | 165 | bye@acme.com              | 0 |
  
  Running the query would result in
  
  | SubID | EMail | IsActive |
  | -------------- | -------------- | -------------- |
  | 123 | hello@acme.com            | 1 |
  | 789 | hi@acme.com               | 1 |
  | 165 | bye@acme.com              | 0 |
  
  Another example
  
  | SubID | EMail | IsActive |
  | -------------- | -------------- | -------------- |
  | 123 | hello@acme.com            | 0 |
  | 456 | hello@acme.com            | 0 |
  | 789 | hi@acme.com               | 1 |
  | 165 | bye@acme.com              | 0 |
  
  Running the query would result in
  
  | SubID | EMail | IsActive |
  | -------------- | -------------- | -------------- |
  | 123 | hello@acme.com            | 0 |
  | 789 | hi@acme.com               | 1 |
  | 165 | bye@acme.com              | 0 |
  
  Thanks!
  </code></pre>
  <p>Sorry for the poor formatting but SO keeps saying &quot;Your post appears to contain code...&quot;</p>