CREATE PROCEDURE GetNthUserByStatus @stat INT, @nth INT AS BEGIN SELECT idUser, nameUser, statusUser FROM ( SELECT idUser, nameUser, statusUser, ROW_NUMBER() OVER(ORDER BY idUser) AS RowNo FROM [Users] WHERE statusUser = @stat ) AS T WHERE T.RowNo = @nth END
SELECT TOP 1 * FROM myTable WHERE ID NOT IN ( SELECT TOP 1 ID FROM myTable ORDER BY ID ) ORDER BY ID
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)