测试数据
ID TIME VALUE
1 2009-01-01 11
1 2009-02-01 12
1 2009-03-01 13
1 2009-04-01 14
2 2009-05-02 15
2 2009-01-01 16
3 2009-02-01 17
2 2009-03-01 18
2 2009-04-01 19
3 2009-05-02 22
3 2009-05-02 21
3 2009-05-02 23
我现在想按ID号来统计 2009-01-01到2009-05-02 VALUE的平均值(2009-01-01的VALUE 减去 2009-05-02的VALUE)这个语句怎么写啊。
ID TIME VALUE
1 2009-01-01 11
1 2009-02-01 12
1 2009-03-01 13
1 2009-04-01 14
2 2009-05-02 15
2 2009-01-01 16
3 2009-02-01 17
2 2009-03-01 18
2 2009-04-01 19
3 2009-05-02 22
3 2009-05-02 21
3 2009-05-02 23
我现在想按ID号来统计 2009-01-01到2009-05-02 VALUE的平均值(2009-01-01的VALUE 减去 2009-05-02的VALUE)这个语句怎么写啊。
from table
where time between '2009-01-01' and '2009-05-02'
group by id
from tbname
where time between '2009-01-01' and '2009-05-02'
group by id
from tb
where time between '2009-01-01' and '2009-05-02'
grup by id
from tb
where time between '2009-01-01' and '2009-05-02'
group by id