Created
January 26, 2018 18:54
-
-
Save thorsman99/3f39a27ba85cb18b30ee55932db075b7 to your computer and use it in GitHub Desktop.
Get average time between records #SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select AVG(CAST(DATEDIFF(MINUTE,B.TimeStamp,A.TimeStamp) AS int)) AvgTime | |
from tblLoadPoint A | |
OUTER APPLY (SELECT TOP 1 * | |
FROM tblLoadPoint | |
Where TimeStamp < A.TimeStamp | |
Order By TimeStamp DESC) B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment