title: MYSQL getting duplicate values from a table
body: <p>I have mysql table with three fields</p>
  
  <pre><code>host              ipaddress      date
  ----              ---------      -----
  server1.abc.com   10.1.1.1      2011-10-18 22:45:16
  server1           10.1.1.1      2011-12-19 21:56:46
  server2           11.1.1.1      2011-12-18 21:56:46
  server2.abc.com   11.1.1.1      2011-12-17 21:56:46
  
  Here,
  host --&gt; varchar
  ipaddress --&gt; varchar
  date ---&gt; datetime
  </code></pre>
  
  <p>I want to select <code>host</code> in the table which have duplicate entries for <code>ip</code>
  I only want to check duplicate entry for host only if <code>date like '2011-12-19%'</code></p>
  
  <p>From above table, my result should satisfy condition <code>date like '2011-12-19%'</code></p>
  
  <pre><code>host              ipaddress      date
  ----              ---------      -----
  server1.abc.com   10.1.1.1      2011-10-18 22:45:16
  server1           10.1.1.1      2011-12-19 21:56:46
  </code></pre>
  
  <p>I have written following query but getting 0 rows</p>
  
  <pre><code>select * from table p1
  group by p1.ipaddress having count(*) &gt;= 2
  and p1.date like '2017-12-19%' 
  ;
  </code></pre>