我的sql 数据库字段设计如下:
年(smallint) 月(tinyint) 日(tinyint) 时(tinyint) 数据(char)
1950 1 1 0 123
1950 1 1 1 456
1950 1 1 2 789
1950 1 1 3 123
.
.
.
2004 5 9 15 558我想查询逐年2月份前一天20点到今天20点的数据平均比如说:
从1950年1月30日20点至1950年2月28日20点的数据 到 1990年1月30日20点至1990年2月28日20点的数据 平均 (也即是每个2月份数据的综合,之后求40年的平均)
请问这个语句怎么写啊???
谢谢大家了
年(smallint) 月(tinyint) 日(tinyint) 时(tinyint) 数据(char)
1950 1 1 0 123
1950 1 1 1 456
1950 1 1 2 789
1950 1 1 3 123
.
.
.
2004 5 9 15 558我想查询逐年2月份前一天20点到今天20点的数据平均比如说:
从1950年1月30日20点至1950年2月28日20点的数据 到 1990年1月30日20点至1990年2月28日20点的数据 平均 (也即是每个2月份数据的综合,之后求40年的平均)
请问这个语句怎么写啊???
谢谢大家了
adors.open "select * from 表名 where 年>1949 and 年<1991 order by 年,月,日,时",ADOdb, adOpenKeyset, adLockOptimistic
adors.filter ="月=2 or 月=1 and 日=31"
'用个循环
for i = 0 to 40
adors.find "年="& "1950+i" & "' and 时=20"
while 年=1950+i
……'读取数据,加起来
adors.movenext
loop
next
最后求平均就行了