WITH cte as (
SELECT ClaimNumber,
ClaimStatus,
ROW_NUMBER() over (PARTITION BY ClaimNumber ORDER BY ActivityDate DESC) as rn
FROM @TempTable
)
SELECT t.*
FROM @TempTable t
JOIN (SELECT *
FROM cte
WHERE rn = 1) f
ON t.ClaimNumber = f.ClaimNumber
AND f.ClaimStatus = 0
SALIDA
Además, si solo tiene 2 estados, también puede hacerlo
WITH cte as (
SELECT ClaimNumber
FROM @TempTable
GROUP BY ClaimNumber
HAVING MAX(ClaimStatus) = 0
)
SELECT t.*
FROM @TempTable t
WHERE ClaimNumber IN (SELECT * FROM cte)