May 25, 2017 at 3:43 am
I've a table where record of different users is saved. I differentiate records based on UserID in the table and have separate mechanism for identifying records uniquely. every user is shown his created records only.
now i want to get next record of user or prev record of the user. means when i click next button in my application i get next record of logged in user.
how can i do it in t-sql ?
see the picture below. My UserID is 1 in User_Reg_Id_Num_02 column. when i've opened the record no 32 and when i click next i should get record no 36 because it's the next record of currently logged in user.
May 25, 2017 at 3:47 am
SELECT TOP(1) <columns>
FROM <table>
WHERE User_Reg_Id_Num_02 = @LoggedInUser and Id_Num > @CurrentId_Num
ORDER BY Id_Num ASC;
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply