title: SQL selection query that discards rows that share some value with another row
body: <p>Suppose I have the next SQL table, with these sample values:</p>
  
  <pre><code>ID    Date        User     Publish
  ----------------------------------
  1     05/20/16    Peter    1
  2     05/20/16    Peter    2      &lt;= Discarded
  3     05/20/16    John     2
  4     05/28/16    John     1
  5     05/28/16    John     2      &lt;= Discarded
  6     07/01/16    Peter    2
  7     07/01/16    John     2
  </code></pre>
  
  <p>What I want to get is a query to select all rows but in case there are two rows for the same date and user, retrieve the one with 'Publish' value to '1', so in the example I get the rows 1, 3, 4, 6 and 7.</p>
  
  <p>I resolve the problem programmatically but I wonder if exists a way to solve it with a proper sql query.</p>
  
  <p>Any help will be appreciated.</p>