In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.
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.