title: dateadd seconds < dateadd days issues
body: <p>I have an issue where I'm trying to show the escalations for a specific time frame of a single day I.E. I want to see all the escalations for today based on the priority of the escalation.</p>
  
  <pre><code>SELECT tas.TASK_ID as TICKET, 
  tas.TASKNAME,
  chg.ASLOGID as ASSIGNEE,
  DATEADD(SECOND, logs.SUBMIT_DATE , '19700101') as SUBMIT_DATE,
  tas.PRIORITY,
  FROM dbo.TASK as tas,
  dbo.CHANGE as chg,
  dbo.WORKLOG as logs
  WHERE chg.ASLOGID in ('Some Users')
  and tas.TASKNAME like ('Escalation%')
  and chg.CHANGE_ID = tas.TASK_ID
  and logs.CHANGE_ID = chg.CHANGE_ID
  and logs.SUBMIT_DATE = 
      (Select MAX(logs2.SUBMIT_DATE) from dbo.WORKLOG as 
      logs2 where logs2.CHANGE_ID = logs.CHANGE_ID)
      and DATEADD(SECOND, logs.SUBMIT_DATE , '19700101') &lt; DATEADD(DD, CASE WHEN 
      tas.PRIORITY = 0 THEN -1
      WHEN tas.PRIORITY = 1 THEN -2
      WHEN tas.PRIORITY = 2 THEN -4
      ELSE -6 END, CURRENT_TIMESTAMP)
  Order by SUBMIT_DATE
  </code></pre>
  
  <p>The query I have seems to work in the main but I'm not sure the Second Max Select is working correctly. What happens is I can see a number of escalations at the start of the day but once they've been cleared later in the day another pops up on screen E.G. at 16:30ish yesterday the following Escalation appeared on screen. As far as I can see there's been no change to the PRIORITY.</p>
  
  <pre><code>+-----------------+-------------+----------+---------------------+----------+
  |     TICKET      |  TASKNAME   | ASSIGNEE |     SUBMIT_DATE     | PRIORITY |
  +-----------------+-------------+----------+---------------------+----------+
  | INC000012345678 | Escalation  | User1    | 11/06/2018 09:41:51 |        1 |
  +-----------------+-------------+----------+---------------------+----------+
  </code></pre>
  
  <p>As I've said I'm trying all the escaltions that are likely to pop for the current day and I appreciate the issue is likely with dateadd seconds then trying to count back dateadd days but I would have expected the above to have popped after 09:41? I'm relatively new to this so i might be being a little naive in how this is working.</p>
  
  <p>Appreciate the adivce in getting this right and thanks in advance.  </p>