日期:2014-05-17  浏览次数:20945 次

如何判断数据库某字段最近10条记录相同?
比如我有表 table1 里面有字段x1,时间字段times

我怎么才能判断最近五分钟里面 十条记录里面X1的值是否相同?

------解决方案--------------------
sql="select top 10 x1 from table1 where datediff(mm,times,getdate()) <= 5 group by x1"
rs.open sql,conn,1,1
if rs.recordcount <> 10 then
有相同
end if

------解决方案--------------------
sql="select top 10 * from table where datediff(mm,times,getdate()) <= 5 "