Date overlap or outgoing time missing

Sorry.
I couldn't make my point clear.
Derived table is acceptable.
But within that derived table is it possible to find problematic rows
without using self joins like.
........
from cte CurRow
left join cte NextRow
on CurRow.Emp_code = NextRow.Emp_Code
and CurRow.RowNum = NextRow.RowNum + 1
left join cte PrevRow
on CurRow.Emp_code = PrevRow.Emp_Code
and CurRow.RowNum + 1 = PrevRow.RowNum

In my mind is lead/lag, bounded preceding etc (i am very weak on these terms)

You'll need some type of join, since the only way to determine if the current row is a duplicate of another row is to look at other rows. That is, how could I possibly know the timeout and dateout in the current row also appear in another row without checking those rows?

1 Like

ok. thanks.