title: SQL - Select All Rows That Are 24 Hours Before Timestamp
body: <p>I want to make a system that sends a reminder email for an appointment 24 hours before the actual appointment.</p>
  <p>I have this:</p>
  <pre><code>SELECT * FROM appointments WHERE reminder_email_sent = 0 AND deleted = 0 AND datetime &gt; NOW() - INTERVAL 1 DAY
  </code></pre>
  <p><code>datetime</code> is the <em>YYYY-MM-DD HH:MM</em> timestamp in the database.</p>
  <p>Using this query, rows that are much later (like <code>2021-10-07 12:00</code>) are also showing up. How can I make it so it only shows me rows that are 24 hours before <code>datetime</code>?</p>