mssql how to get the previous row and next row value using select statement  Edit
 Edit
                    
                    
                    you can use the LAG and LEAD function to get the previous and next row in SQL server while using the select statment
Solution
select LAG(Id) OVER (ORDER BY DisplayOrder) PreviousId,Id, LEAD(Id) OVER (ORDER BY DisplayOrder) NextId, DisplayOrder,ImageId from ItemImageMapping where ItemId = @ItemId                
                    
                     
            
         
                         27 November 2020 |
 27 November 2020 |  3144
3144