 <p>Toy can try something like this</p> <pre><code> declare @t table (i int, d datetime) insert into @t (i, d) select 1, '17-Nov-2009 07:22:13' union select 2, '18-Nov-2009 07:22:14' union select 3, '17-Nov-2009 07:23:15' union select 4, '20-Nov-2009 07:22:18' union select 5, '17-Nov-2009 07:22:17' union select 6, '20-Nov-2009 07:22:18' union select 7, '21-Nov-2009 07:22:19' --order that I want select * from @t order by d desc, i declare @currentId int; set @currentId = 4 SELECT TOP 1 t.* FROM @t t INNER JOIN ( SELECT d CurrentDateVal FROM @t WHERE i = @currentId ) currentDate ON t.d &lt;= currentDate.CurrentDateVal AND t.i != @currentId ORDER BY t.d DESC SELECT t.* FROM @t t INNER JOIN ( SELECT d CurrentDateVal FROM @t WHERE i = @currentId ) currentDate ON t.d &gt;= currentDate.CurrentDateVal AND t.i != @currentId ORDER BY t.d </code></pre> <p>You must be carefull, it can seem that 6 should be both prev and next.</p>