title: SQL query to select range from specific date/time yesterday to specific date/time current day
body: <pre><code>SELECT * 
  FROM services 
  WHERE service_date BETWEEN (dateadd(DD, -1, getdate())) AND (dateadd(DD, 1, getdate())) **---Gives us a last one day data.**
  </code></pre>
  
  <p>but what we really need is data from <code>07:00 AM</code> yesterday to <code>06:59 AM</code> current day, so I tried the following:</p>
  
  <pre><code>SELECT * 
  FROM services 
  WHERE service_date BETWEEN (dateadd(DD, -1,((DatePart(hh, getdate())) &gt;= 7 ))) **-- Expecting to pull from yesterday 07:00** 
                     AND (dateadd(DD, -1,((DatePart(hh, getdate())) &lt;= 6 ))) **-- to current day till 06:59**
  </code></pre>
  
  <p>but the system didn't like my SQL skills ...PLEASE HELP...!</p>