写入数据量同时更新表,在代码层上实现还是触发器。 这样查询也,多台查询多也最,; with tmp as( select (row_number() over(partition by Gdcode order by gdate desc)) as num ,* from Glog2 where Gdwork='''+lwork+''' and Gdclass in ('+lc+') and Gdate BETWEEN dateadd(ss,-1*('+Trtime+'),GETDATE()) and getdate() ) select * from tmp where num=1
----------------------------------------------
free
首先脏读,表后面加 With(Nolock),其次建好索引,查询可以改成这样SELECT TOP 100 * FROM DBO.TABLE WITH(NOLOCK) ORDER BY tDateTime Desc
----------------------------------------------
-