How to Get the MAX Time Difference Between Any 2 Consecutive Rows Per Value?

J

joeyjones

Guest
How could I pull the maximum CreateDT difference between any two consecutive rows/[Position], per CODE, based on the CTE below:

WITH OccDiff AS
(
SELECT
CODE
, CreateDT
, ROW_NUMBER() OVER(PARTITION BY CODE ORDER BY CreateDT DESC) Position FROM Occs
)

Continue reading...
 
Top