select * from
(
select * from Table1
where datediff(mi,Time,getdate())<50
)a where not exists(select * from
(select * from Table1
where datediff(mi,Time,getdate())<50)b where a.STID=b.STID and datediff(mi,a.Time,b.Time)>10 )
(
select * from Table1
where datediff(mi,Time,getdate())<50
)a where not exists(select * from
(select * from Table1
where datediff(mi,Time,getdate())<50)b where a.STID=b.STID and datediff(mi,a.Time,b.Time)>10 )
解决方案 »
- 菜菜求教查询的问题
- 安装sqlserver2000之后,打开企业管理器,怎么没有数据库之类的文件
- 初学者的一个简单问题:关于ANY和MIN(),为何结果不一样?
- DBA该怎么走?
- 这道题关于cached data collection
- 大家救救我,帮我看看
- 请问等级与专家分的关系如何,回答有分
- 怎样在其他应用程序中,显示后台数据库SQLSERVER中的,自编写的触发器的错误提示对话框?
- 关于调查报告多选题显示为一个字段的内容(多字段合并为一个字段)
- 无法加载DLL.xpstar90.dll或它引用的一个DLL原因126
- 连接数据库SQL2000的怪问题?
- 急求教,在线:sql2000 安装问题。安装程序配置服务器失败。参考服务器错误日志和 C:\WINNT\sqlstp.log
SELECT a.* FROM 表 a join 表 b on datediff(mi,a.time,getdate())>50 and a.STID=b.STID and a.time<>b.time group by a.stid,a.time
having min(abs(datediff(mi,a.time,b.time)))>=10
select * from table1 a
where datediff(minute,Time,getdate())<50 and
not exists (select 1 from table1 where abs(datediff(minute,a.Time,Time))<10)
(
select * from Table1
where datediff(mi,Time,getdate())<50
)a where not exists(select * from
(select * from Table1
where datediff(mi,Time,getdate())<50)b where a.STID=b.STID and a.Time<b.Time and datediff(mi,a.Time,b.Time)<10 )