title: MySQL Filter databse query by time and look for duplicates
body: <p>I am running a query based on previous answers I have found for wordpress. I wish to look for duplicates 'track' posts within the last half an hour. I want to display all duplicates and ignore the first post within that time period.  </p>
  
  <p>I have taken a solution I found and added in the time function but I am seeing all posts including the original post, it is not removing the first post. I believe this may be because it is searching all post entires in the table and then adding in the time filter. I have tried adding the time filter into the select function but it brings up an error saying unknown post_date column.</p>
  
  <p>The below gives me all duplicates within the last half an hour, I need it to remove the first entry.</p>
  
  <pre><code>SELECT a. *
  FROM wp_posts AS a
     INNER JOIN (
        SELECT post_title, MIN( id ) AS min_id
        FROM wp_posts
        WHERE post_type = 'track'
        AND post_status = 'publish'
        GROUP BY post_title
        HAVING COUNT( * ) &gt; 1
     ) AS b ON b.post_title = a.post_title
  AND b.min_id &lt;&gt; a.id
  AND a.post_type = 'track'
  AND a.post_status = 'publish'
  AND a.post_date &gt; subtime(now(),'0:30:0')
  </code></pre>
  
  <p>The expected result would be all duplicates within the last half an hour and it will not display the original post. Currently it gives me all duplicates and the original.</p>