title: select data before & after midnight
body: <p>I have a dashboard that reports production for each hour of a shift. The dashboard has fixed slots for each hour of the shift.</p>
  
  <ul>
  <li>When the shift is 7am to 7pm all is fine.</li>
  <li>When the shift is 7pm to 7am then I have an issue.</li>
  <li>7pm to 8pm is fine</li>
  <li>8pm to 9pm is fine</li>
  <li>9pm to 10pm is fine</li>
  <li>10pm to 11pm is fine</li>
  <li>11pm to 12pm is fine</li>
  <li>12pm to 1am is an issue - The issue is that when you log on to the dashboard at 7pm I pick up the production for today’s production from midnight to 1am.
  How can I code my sql to ignore data from midnight to 1am before midnight and select it after midnight?</li>
  </ul>
  
  <p>Here is the SQL that i am using</p>
  
  <pre><code>select date_time_created,
         ith.quantity
  From   ifsapp.inventory_transaction_hist2 ith
  where  TRANSACTION_CODE = 'OOREC'
  and    upper(ifsapp.Inventory_Part_API.Get_Unit_Meas('WW001',PART_NO) ) =upper( 'CS' )
  and    date_time_created -1 - 60*60*7/86400 &gt;= to_date(to_char(sysdate -1,'DD/MM/YYYY') || ' 19:00:00','DD/MM/YYYY HH24:MI:SS')- 60*60*7/86400
  and    date_time_created - 60*60*7/86400 &lt;= to_date(to_char(sysdate,'DD/MM/YYYY') || ' 19:59:59','DD/MM/YYYY HH24:MI:SS')- 60*60*7/86400
  and    userid='3520'
  </code></pre>
  
  <p>thanks</p>