表:(表名:history) 名字段为数字型 pp0为主键
pp0 pp1 pp2 pp3 pp4 pp5 number1 number2
1    2   3   4   5  6
2    4   5   6   7   8
3    11  12  13  14  18
4    15  16  17  18  19
.......................
问题:主要是统计相邻两条纪录之和除3余0的个数。如第1条与第2之间pp1之和2+4除3余0,pp4之和5+7除3余0,共有两个字段符合,那么在第2条纪录的number1写入2;依次类推,第2条与第3条符合条件有2个,则在第3条纪录的number1写入2;第3条与第4条有1个,则在第4条的number1写入1要求:不用游标,用少量的sql语言实现。
我的做法:用下列语句生成一个纪录集。它将大于第2条纪录的集合向上移动了一条,方便更新,但我在使用update 时老报错,怎么将update 与下面的sql语句结合起来了,请支招!
         "select a1.pp1,a1.pp2,a1.pp3,a1.pp4,a1.pp5,a1.ppp,a1.number1,a2.pp1,a2.pp2,a2.pp3,a2.pp4,a2.pp5 from history a1,history a2 where a1.pp0+1=a2.pp0"能否给出access 和sql server两种语句