日期:2014-05-17 浏览次数:20599 次
select cast((cast(((cast((count(P0.act_power_value1)+ count(P1.act_power_value1)
+ count(P2.act_power_value1)+ count(P3.act_power_value1)+ count(P4.act_power_value1))
as float)/(nullif(cast((count(P0.act_power_value2)+ count(P1.act_power_value2)
+ count(P2.act_power_value2)+count(P3.act_power_value2)+ count(P4.act_power_value2))
as float),0)))*100)as decimal(18,1)))as Nvarchar)+'%'
from(SELECT LOCALTIME as LOCALTIME FROM [DB_EasyPilot].[dbo].[WCI0NGNVSV7E48G] )as TIME_STAMP
LEFT OUTER JOIN(SELECT(case when ActivePower>0 then ActivePower else null end )
as act_power_value1,ActivePower As act_power_value2, LocalTime As tstamp_value
from [DB_EasyPilot].[dbo].[WCI0NGNVSV7E48G]
where WindSpeed >= 3.5 AND WindSpeed <25)as P0 on time_stamp.LOCALTIME =P0.tstamp_value
LEFT OUTER JOIN(SELECT (case when ActivePower>0 then ActivePower else null end )
as act_power_value1,ActivePower As act_power_value2, LocalTime As tstamp_value
from [DB_EasyPilot].[dbo].[WCI0NHNVSV3E48G]
where WindSpeed >= 3.5 AND WindSpeed <25) as P1 on time_stamp.LOCALTIME =P1.tstamp_value
LEFT OUTER JOIN(SELECT (case when ActivePower>0 then ActivePower else null end )
as act_power_value1,ActivePower As act_power_value2, LocalTime As tstamp_value
from [DB_EasyPilot].[dbo].[WCI4NHNVSV3E48G]
where WindSpeed >= 3.5 AND WindSpeed <25) as P2 on time_stamp.LOCALTIME =P2.tstamp_value
LEFT OUTER JOIN(SELECT (case when ActivePower>0 then ActivePower else null end )
as act_power_value1,ActivePower As act_power_value2, LocalTime As tstamp_value
from [DB_EasyPilot].[dbo].[WCI4NHNVSV7E48G]
where WindSpeed >= 3.5 AND WindSpeed <25) as P3 on time_stamp.LOCALTIME=P3.tstamp_value
LEFT OUTER JOIN(SELECT (case when ActivePower>0 then ActivePower else null end )
as act_power_value1,ActivePower As act_power_value2, LocalTime As tstamp_value
from [DB_EasyPilot].[dbo].[WCI4NGNVSV3E4AG]
where WindSpeed >= 3.5 AND WindSpeed <25)as P4 on time_stamp.LOCALTIME =P4.tstamp_value
where LOCALTIME >='01/12/2011'
and LOCALTIME <'02/12/2011'