我的表:
如果power_output值之间只有一个'Zero'
,那么我需要检查绝对平均值less than 5%
是否为绝对平均值(0.05*absolute average value)
。
如果是这种情况,我们需要将零值更改为前一行值的平均值。
如果power_output的值逐渐下降,我需要检查该值是否为greater than 0.25*Name_plate
。
如果是这种情况,我需要更新上一行值。
Sitename |date&time |Power_output |Name_Plate|
ACT0001 | 2013-07-21 02:00:00.000 |196.852984494331 |100
ACT0001 | 2013-07-21 02:00:00.000 |196.860450855433 |200
xyz0001 |2013-07-21 02:00:00.000 |196.852984494331 | 100
xwz0001 ||2013-07-21 02:00:00.000 || 196.860450855433 || 200
xyq0001 ||2013-07-21 02:00:00.000 || 196.958395639561 || 100
xys0001 ||2013-07-21 02:00:00.000 || 197.045580192147 || 150
xyd0001 ||2013-07-21 02:00:00.000 || 197.089550181982 || 100
xye0001 ||2013-07-21 02:00:00.000 || 197.20098185022 || 200
xyg0001 ||2013-07-21 02:00:00.000 || 0 || 200
cfg0001 ||2013-07-21 02:00:00.000 || 197.412144323522 || 200
acb0001 ||2013-07-21 02:00:00.000 || 196.852984494331 || 100
bdf0001 ||2013-07-21 02:00:00.000 || 196.860450855433 || 150
olk0001 ||2013-07-21 02:00:00.000 || 196.886233049016 || 100
ujh0001 ||2013-07-21 02:00:00.000 || 0 || 100
iop0001 ||2013-07-21 02:00:00.000 || 196.852984494331 || 100
qrw0001 ||2013-07-21 02:00:00.000 || 196.852984494331 || 100
kml0001 ||2013-07-21 02:00:00.000 || 196.852984494331 || 100
abc0001 ||2013-07-21 02:00:00.000 || 196.852984494331 || 100
ACT0001 ||2013-07-08 18:00:00.000 || 197.161464379509|| 200
ACT0001 ||2013-07-08 19:00:00.000 || 197.203924005547|| 200
ACT0001 ||2013-07-08 20:00:00.000 || 197.109157360779|| 200
ACT0001 ||2013-07-08 21:00:00.000 || 197.062176347927|| 200
ACT0001 ||2013-07-08 22:00:00.000 || 196.933951782133|| 200
ACT0001 ||2013-07-08 23:00:00.000 || 196.720954466091|| 200
ACT0001 ||2013-07-09 00:00:00.000 || 53.4555526290512|| 200
ACT0001 ||2013-07-09 01:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 02:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 03:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 04:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 05:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 06:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 07:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 08:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 09:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 10:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 11:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 12:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 13:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 14:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 15:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 16:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 17:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 18:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 19:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 20:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 21:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 22:00:00.000 || 0 || 200
ACT0001 ||2013-07-09 23:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 00:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 01:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 02:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 03:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 04:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 05:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 06:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 07:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 08:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 09:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 10:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 11:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 12:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 13:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 14:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 15:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 16:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 17:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 18:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 19:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 20:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 21:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 22:00:00.000 || 0 || 200
ACT0001 ||2013-07-10 23:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 00:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 01:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 02:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 03:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 04:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 05:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 06:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 07:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 08:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 09:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 10:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 11:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 12:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 13:00:00.000 || 0 || 200
ACT0001 ||2013-07-11 14:00:00.000 || 69.2397589844922|| 200
ACT0001 ||2013-07-11 15:00:00.000 || 129.878528692876|| 200
ACT0001 ||2013-07-11 16:00:00.000 || 129.946054198695|| 200
输出的一部分应该是这样的(这是他们没有连续零的时候)
* xyd0001 || 2013-07-21 02:00:00.000 || 197.089550181982 || 100
xye0001 ||2013-07-21 02:00:00.000 || 197.20098185022 || 200
xyg0001 ||2013-07-21 02:00:00.000 ||197.20098185022 || 200
cfg0001 ||2013-07-21 02:00:00.000 || 197.412144323522 || 200*
如果答案少于(0.05 *绝对平均值)的5%,那么我需要将前一个值复制为零到NULL列中。
如果答案是(0.05 *绝对平均值)的5%以上,那么我需要保留零值。