我的表包含大约 5000 行。我想知道表格中的特定行位置。我的存储过程是:
CREATE PROC Sp_getrownumber(@MemberID INT)
AS
SELECT Row_number()
OVER ( ORDER BY joiningdate ASC) AS Rownumber,
M.memberid,
P.name,
M.joiningdate
FROM tblmemberdata M
JOIN tblpersonaldetails P
ON M.memberid = P.memberid
但是当我尝试 2 获取特定行时,行号显示为 1。代码是:
CREATE PROC Sp_getrownumber(@MemberID INT)
AS
SELECT Row_number()
OVER ( ORDER BY joiningdate ASC) AS Rownumber,
M.memberid,
P.name,
M.joiningdate
FROM tblmemberdata M
JOIN tblpersonaldetails P
ON M.memberid = P.memberid
WHERE M.memberid = @MemberID
如何获取确切的行号?