- SELECT T1.日期,T1.时间,T1.标题,T1.链接,T1.店铺,T1.日累积销量,T1.评价数,T1.商品ID,IIF(T2.日累积销量,(T1.日累积销量-T2.日累积销量)/(T1.日期-T2.日期),0) AS 日销量 FROM
- (SELECT A.日期,A.时间,A.标题,A.链接,A.店铺,A.日累积销量,A.评价数,A.商品ID,SUM(1) AS 序列 FROM [Sheet1$]A,[Sheet1$]B where A.商品ID=B.商品ID AND A.日期>=B.日期 GROUP BY A.日期,A.时间,A.标题,A.链接,A.店铺,A.日累积销量,A.评价数,A.商品ID)T1
- LEFT JOIN
- (SELECT A.日期,A.时间,A.标题,A.链接,A.店铺,A.日累积销量,A.评价数,A.商品ID,SUM(1) AS 序列 FROM [Sheet1$]A,[Sheet1$]B where A.商品ID=B.商品ID AND A.日期>=B.日期 GROUP BY A.日期,A.时间,A.标题,A.链接,A.店铺,A.日累积销量,A.评价数,A.商品ID)T2
- ON T1.商品ID=T2.商品ID AND T1.序列=T2.序列+1
复制代码 |