title: MySQL days before based on setting in other table
body: <p>The current query checks if the a it is the customers birthday today and if the processTime is this hour. This works like a charm. However we want to adjust the query and also send customers a email x days before there birthday. That depends on the dayOffset setting in birthday_settings. </p>
  
  <p>dayOffset can be in the range of -365 to +365. </p>
  
  <p>What should I adjust to the below query. The birthday column is a date column</p>
  
  <pre><code>SELECT firstName, lastName, birthday, FROM 
      birthday_customers C
      INNER JOIN
      birthday_settings S
          ON C.customerId = S.customerId
  WHERE 
      MONTH(birthday) = MONTH(NOW()) 
      AND DAY(birthday) = DAY(NOW())
      AND processTime = HOUR(NOW())
  </code></pre>