Why aer you joining the table to itself?
If you can avoid INNER JOIN and just use CTE, that's the better way of doing it
is that because you need Row_Number() = 2?
If yes, you don't need to do inner join
use CTE without JOIN
;with cte as ( SELECTROW_NUMBER () OVER (ORDERBY ParentLoginID ASC ) AS RowNumber, [ParentLoginID], [LoginName], [LoginPwd], [LoginSSN], [MultiFactorQuestion], [MultiFactorAnswer] FROM [MMA_TestCases].[dbo].[v_CompleteLogin] ) select [ParentLoginID], [LoginName], [LoginPwd], [LoginSSN], [MultiFactorQuestion], [MultiFactorAnswer] from cte where rownumber = @yourVariable
Thanks, Cool Mind -- If you find my answer helpful, please mark it as Answer.