一个非常难搞的sql查询,高手请进
开始表中的原始数据是这样的:
emp_Id happen_date sale sale_month_sum---------- ----------- ----------- --------------E01 2012-01-01 100 0E01 2012-01-02 200 0E01 2012-01-03 500 0E01 2012-01-04 700 0E01 2012-01-05 150 0E01 2012-01-06 0 0E02 2012-01-02 600 0E02 2012-01-03 0 0E02 2012-01-04 300 0E02 2012-01-05 800 0E02 2012-01-06 0 0
emp_Id happen_date sale sale_month_sum---------- ----------- ----------- --------------E01 2012-01-01 100 100E01 2012-01-02 200 300E01 2012-01-03 500 800E01 2012-01-04 700 1500E01 2012-01-05 150 1650E01 2012-01-06 0 1650E02 2012-01-02 600 600E02 2012-01-03 0 600E02 2012-01-04 300 900E02 2012-01-05 800 1700E02 2012-01-06 0 1700