我数据库表如下
ID 字段1 字段2
1 a
2 b → (a+b+c)/3
3 c → (b+c+d)/3
4 d → (c+d+e)/3
5 e → .....
. . .....
把相邻2个记录求平均值后放在字段2中生成新记录
各位高手,我是初学者,还请指点。
请给出详细的语句代码,谢谢。
ID 字段1 字段2
1 a
2 b → (a+b+c)/3
3 c → (b+c+d)/3
4 d → (c+d+e)/3
5 e → .....
. . .....
把相邻2个记录求平均值后放在字段2中生成新记录
各位高手,我是初学者,还请指点。
请给出详细的语句代码,谢谢。
picture1.PSet(时间信号,字段1)画了根曲线,由于字段1波动大曲线毛刺多,想把数据整理后重画曲线过滤掉多余的毛刺,相当于滤波效果。可能还有很好的方法,请大侠指点
isnull(name+(select name from #1 where id=bbb.id-1)+(select name from #1 where id=bbb.id+1),'')/3
from #1 bbb
insert into #1
select 1,1 union all
select 2,2 union all
select 3, 3 union all
select 4,4 union all
select 5,5select [id],name,
isnull(name+(select name from #1 where id=bbb.id-1)+(select name from #1 where id=bbb.id+1),'')/3
from #1 bbb
用自连接select a.ID,a.字段1,a.字段2=(a.字段1+b.字段1+c.字段1)/3 from 表名 a, 表名 b, 表名 cwhere a.ID=b.ID+1 and a.ID=c.ID-1
---------
随手写的,你自己调试吧