oracle 查询某个字段相同并且时间满足某个条件(重复)的数据
SELECT ID,JOB_NUMBER,CHECK_TIME,REPEAT_TIME,REPEAT_TIME2 FROM (
SELECT ID,JOB_NUMBER,CHECK_TIME,LAG(CHECK_TIME,1)OVER(PARTITION BY JOB_NUMBER ORDER BY CHECK_TIME asc) REPEAT_TIME,LAG(CHECK_TIME,1)OVER(PARTITION BY JOB_NUMBER ORDER BY CHECK_TIME DESC) REPEAT_TIME2 FROM "CK_TIME_RECORD"
)
where ((trunc(abs(CHECK_TIME - REPEAT_TIME) * 24 * 60 * 60 ) <= 30) AND (trunc(abs(CHECK_TIME - REPEAT_TIME) * 24 * 60 * 60 ) >0 ) ) or ((trunc(abs(CHECK_TIME - REPEAT_TIME2) * 24 * 60 * 6
共有 0 条评论