I have a query that has a RANK() OVER
function inside it but I would like to use the results displayed on this column in the WHERE clause that follows. How do I write that as all the other questions I have looked at did not have RANK() OVER
and seemed easier to do. Here is the statement:
USE SMSResults
SELECT Student_No,Result,Module_Name,Semester,Year,RANK() OVER (PARTITION BY Student_No ORDER BY Semester DESC) AS Rnk
FROM tbl_results
WHERE Student_No = '201409'
ORDER BY Year DESC
I would like to use the Rnk
column in the WHERE
clause