title: SQL, select entries older than 30 days, filter entries older than 30 days that have entries within the last 30 days
body: <p>Not the best worded question I'll admit. I am trying to write a query to select entries older than 30 days. I have this so far</p>
  
  <pre><code>SELECT farm_list.customer_id, data_stored.`timestamp`  
  FROM farm_db.data_stored data_stored
         INNER JOIN farm_db.farm_list farm_list
            ON (data_stored.farm_code = farm_list.farm_code)
  WHERE data_stored.`timestamp` &gt;= CURDATE() - 30
  GROUP BY farm_list.customer_id
  </code></pre>
  
  <p>This works to select all the entries older than 30 days and group them by customer. </p>
  
  <p>So some customers have entries within the last 30 days AND older than 30 days. I would like to exclude those customers. The aim of the query is to highlight inactive customers. The data_stored table is updated every time there is customer activity on the server. </p>
  
  <p>If I've been unclear, please just ask and I'll try to clarify. Any help would be much appreciated.</p>