SQL Server语法:
库名
LMInterface(中间库)
SELECT COUNT(*) AS cont FROM Image where datediff(hh,CheckDateTime,GETDATE())<=1
SELECT COUNT(*) AS cont FROM Image where datediff(hh,CheckDateTime,GETDATE())<=6
SELECT count(*) AS cont FROM StudyInfo where ArchiveFlag=-1
Select count(*) AS cont FROM dbo.StudyInfo where ArchiveFlag=0
LM_StudyMonitor(监控库)
SELECT count(*) AS cont FROM StudyCount WHERE LogDatetime>=getdate()-1 AND RISNumber > FTDocNumber(只查找有没有漏传的)
SELECT isnull(RISNumber,0)-isnull(FTDocNumber,0) AS cont FROM StudyCount WHERE LogDatetime>=getdate()-1(可以计算漏传多少)
SELECT (case when isnull(PACSNumber,0)-isnull(RISNumber,0) <0 then 0 else isnull(PACSNumber,0)-isnull(RISNumber,0) end)AS cont FROM StudyCount WHERE LogDatetime>=getdate()-1(相减得负的值值为零)
DocRouter(正式库)
Select count(*) FROM Docimage where [30011041]=3 and datediff(dd,[00080020],getdate())<1
SELECT COUNT(*) AS cont FROM StudyInfo where datediff(hh,CreateTime,GETDATE())<=6
SELECT COUNT(*) AS cont FROM StudyInfo where datediff(hh,CreateTime,GETDATE())<=1
Oracle语法:
select COUNT(*) AS cont from V_DocReport
where ReportDatetime >= SYSDATE-numtodsinterval(15,'minute')
Mysql语法:
SELECT COUNT(*) AS cont from V_DocReport where now() < SUBDATE(ReportDatetime,interval -15 minute)