Programming language used to interact with SQL Server databases
Hi @Learner DAX
Based on Erland's code, how about modifying where clause like this:
; WITH CTE AS (
SELECT Id, "DT-time", Other_ID,
nextOther_ID = LEAD(Other_ID) OVER(ORDER BY Id)
FROM tbl
)SELECT Id, "DT-time", Other_ID
FROM CTE
WHERE nextOther_ID IS NULL AND Other_ID IS NOT NULL
Best regards,
Cosmog
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".