title: Creating a table of workers with first shift last week
body: <p>I am trying to extract a list of workers who had their first shift during last week. </p>
  
  <p>Right now, my SQL works if I put a specific worker with a first shift in last week in my where clause (<code>WHERE c.temp_nr ='XXXX'</code>), but when I remove that clause, it just timeout</p>
  
  <pre><code>SELECT MIN(p.start_date), CONCAT(c.first_name, ' ', c.last_name) AS 'c.fullname', c.temp_nr
  FROM contactstable c 
  LEFT JOIN projectlines p on c.temp_nr = p.candidate_number 
  WHERE c.temp_nr ='XXXX' and c.contact_type = 'Candidate' 
  HAVING MIN(p.start_date) between DATE_SUB( CURDATE( ) , INTERVAL (dayofweek(CURDATE())+6) 
  DAY ) 
  AND DATE_SUB( CURDATE( ) , INTERVAL (dayofweek(CURDATE())) 
  DAY )
  </code></pre>