用sql语句,如何求累计销售额的问题
//表结构如下
create table storeCase
(contentDate char(10) not null, --日期
productID int not null, --产品ID
amount int not null --销售数量
)
求,各个产品,各个日期的累计销售额
例如根据如下数据,
产品ID 日期 销售额
1 2003-1-1 10
1 2003-1-2 15
2 2003-1-1 5
2 2003-1-2 15
得出如下内容
产品ID 日期 销售额 累计销售额
1 2003-1-1 10 10
1 2003-1-2 15 25
2 2003-1-1 5 5
2 2003-1-2 15 20