|

楼主 |
发表于 2007-12-14 16:37:05
|
显示全部楼层
sql语句如下:
select t.datetime as 时间,
round(t0.value,2) as DB1额定值烟流量,round(t1.value,2) as DB1实际值烟流量
from (select t.datetime,t.value from history t
where (wwRetrievalMode = 'Cyclic' and wwResolution = 5000 and opcquality=192)
and t.tagname in ('Z11DB1Value_1') and t.datetime >= '2007-11-26 08:30:00'
and t.datetime <= '2007-11-26 09:00:00') t0,(select t.datetime,t.value from history t
where (wwRetrievalMode = 'Cyclic' and wwResolution = 5000 and opcquality=192)
and t.tagname in ('Z11DB1Value_2') and t.datetime >= '2007-11-26 08:30:00'
and t.datetime <= '2007-11-26 09:00:00') t1,
(Select distinct t.datetime
from openquery(InSQL,'select t.datetime from history t
where t.tagname in ("Z11DB1Value_1","Z11DB1Value_2")
and t.datetime >=''2007-11-26 08:30:00'' and t.datetime <=''2007-11-26 09:00:00''
and (wwRetrievalMode = "Cyclic" and wwResolution = 5000 and opcquality=192)') t) t
where t.datetime = t0.datetime and t.datetime = t1.datetime |
|