PK_Name LastName FirstName
------------------------------------ ----------- ----------
86405F3D-F928-4EEE-8460-98ED9FA82379 Anderson Grant
6A3A4BEF-2F21-4BE6-BE9A-B6298B0BD7B9 Anderson Chris
68528A47-EE1A-40AA-87F7-ED6BDAF27770 Anderson Terry
644D5299-29E3-4F53-A8ED-F6DF42C2BB86 Anderson Edwin
B6FB293A-D650-4894-B5EF-EC7E34D55064 Andriani Drew
C7C7E3F6-93CE-4F1A-AEF2-FA3ACCE33CD7 Andritzky Christian
3E4BB82C-C7DF-4BFF-974E-BC47EDC7264D Angelly Clay
3EFA8C5E-B06C-4107-BD0B-D6D11542B213 Antonitis Nancy
FD571681-DE6B-47B3-AD88-F4C00A7B71A2 Anwari Aman
A4A7F32C-2F72-4314-85AC-995DFB7B6194 Anzziani John
20C5FBE3-278D-485D-AF20-9E1BD6136860 Aquino Jun
781B8B34-8E95-45DA-B850-CF6DCC044131 Arastoozad John
I have the row for Clay Angelly (PK 3E4BB82C-C7DF-4BFF-974E-BC47EDC7264D). Now I want to send a SELECT statement to the server to get either the PREVIOUS or NEXT row based on a sort order of last name.select top 1 * from names where cLastName >= 'Angelly' and pk_name > '3E4BB82C-C7DF-4BFF-974E-BC47EDC7264D' order by cLastName, pk_nameWill give me the NEXT row. However,
select top 1 * from names where cLastName <= 'Angelly' and pk_name < '3E4BB82C-C7DF-4BFF-974E-BC47EDC7264D' order by cLastName desc, pk_name descWill not always give me the PREVOIUS row. It does sometimes, but not always.