Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.
WITH CTE AS ( SELECT *, ROW_NUMBER() OVER(ORDER BY pid, MDATE ) Serial FROM #table ) SELECT x.*, CASE WHEN y.pid IS NOT NULL THEN 'FLAG' ELSE '' END FLAG FROM CTE x LEFT JOIN ( SELECT a.* FROM CTE a LEFT JOIN CTE b ON a.Serial - 1 = b.Serial AND a.pid = b.pid WHERE b.MHEIGHT > a.MHEIGHT ) y ON x.pid = y.pid AND x.MDATE = y.MDATE
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
18 Experts available now in Live!