Skip to content

Instantly share code, notes, and snippets.

@sethdorris
Created March 15, 2021 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethdorris/7c4645063c8f0ff71b41889aa4beff05 to your computer and use it in GitHub Desktop.
Save sethdorris/7c4645063c8f0ff71b41889aa4beff05 to your computer and use it in GitHub Desktop.
SELECT COUNT_BIG(t1.Id) FROM dbo.Triggers AS t1
JOIN dbo.Triggers AS t2
ON (
t1.Id < t2.Id
AND
DATEDIFF(MINUTE, t1.TriggerStart, t2.TriggerStart) <= 2
AND
t1.DeviceId != t2.DeviceId)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment