title: Oracle get previous day records
body: <p>Ok I think I'm getting the previous year instead of the previous day, but I need to previous day.</p>
  
  <pre><code>SELECT TO_DATE(TO_CHAR(CURRENT_DATE, 'YYYY-MM-DD'),'YYYY-MM-DD') - 1 FROM Dual
  </code></pre>
  
  <p>I'm comparing it to a datetime stamp in this format and wish to get all the rows from the previous day.</p>
  
  <pre><code>YYYY-MM-DD HH:MM:SS
  </code></pre>
  
  <p>So I'm trying something like this</p>
  
  <pre><code>SELECT field,datetime_field 
  FROM database
  WHERE datetime_field &gt; TO_DATE(TO_CHAR(CURRENT_DATE, 'YYYY-MM-DD'),'YYYY-MM-DD') - 1
  </code></pre>