在CTE结果row_num内查询为1。同样我选择从CTE结果row_num选择1和2是错误的。请让我知道这个缺陷或解决方案。
WITH CTE AS(
SELECT Project_Id,
ROW_NUMBER() over (partition by Test_Defect_Id order by Last_Modified_Date desc) as row_num
FROM dbo.Staging_RADAR_TestDefects
--where Project_Id = 'PRJ-007171'
)
SELECT *
FROM CTE
WHERE Project_Id = 'PRJ-007171'