我有一个包含数百万条记录的表,其中包含日期/时间戳 - 我正在尝试返回差异 > 给定秒数的记录。
该表包含日期/时间戳,但我无法使用位置和计算出的差异。(createddate 是日期字段,updatedon 是日期/时间)
SELECT createddate,
LEAD(createddate, 1) OVER (ORDER BY createddate) AS created_next,
LEAD(createddate, 1) OVER (ORDER BY createddate) - createddate AS created_diff,
LEAD(updatedon, 1) OVER (ORDER BY updatedon) AS created_next,
LEAD(createddate, 1) OVER (ORDER BY updatedon) - updatedon AS Updatedon_diff
FROM gsdaudit
--WHERE created_diff > 1000
ORDER BY updatedon_diff