title: MySQL page view by unique IP
body: <p>I have a MySQL table with three columns: Page, IP and Date. I'm trying to write an SQL line that lists unique views in the last 24 hours by page name. I've tried this:</p>
  
  <pre><code>SELECT Page, COUNT(DISTINCT IP) as views FROM `hits` WHERE DATE &gt;= DATE_SUB(NOW(), INTERVAL 1 DAY) AND IP &lt;&gt; 'unknown' GROUP BY Page ORDER BY views DESC;
  </code></pre>
  
  <p>I do get the grouped page names. However, they all have 1 view. </p>
  
  <p>Also, how can I only list pages that have more than 1 views? I tried WHERE views > 1 but it didn't work.</p>