title: DateAdd & DateDiff Together
body: <p>I have the following query which is looking to select all records where;</p>
  
  <ul>
  <li>ActualMinutes is 5 Greater then or equal to ScheduledMinutes and </li>
  <li>ActualMinutes is 5 Less then or equal to ScheduledMinutes.</li>
  </ul>
  
  <p>E.g. If ScheduledMinutes is 60, I want any ActualMinutes between 55 &amp; 65 (inclusive).</p>
  
  <pre><code>SELECT *
  FROM
      (
          SELECT top 10000
          DateDiff(MI, StartTime, EndTime) as ScheduledMinutes, 
          DateDiff(MI, SignIn, SignOut) as ActualMinutes,
          *
          FROM tblRosteredCare 
          WHERE SignIn != 'M' AND SignOut != 'M' 
      ) DT
  WHERE DT.ActualMinutes &lt;= DT.ScheduledMinutes
  </code></pre>
  
  <p>Thanks for any help </p>