我有一个带有Timestamp列的表,我以这种方式从中选择行:
Select top(@count) * from [table]
Into #Increment
where [Timestamp] > @timestamp
order by [Timestamp]
Select max(Timestamp) from #Increment
Select * from #Increment
同时将服务插入并更新[table]。当我使用上面提到的选择查询从[table]中选择时,有时我会遗漏一些行。我没有看到任何理由。我怎样摆脱这个问题?
谢谢!
答案 0 :(得分:0)
没有返回行的顺序(每次TOP可能返回不同的行),以保持顺序添加"按时间顺序DESC"子句。