with
aa as (SELECT date,avg(amount) amount FROM 数据表 where date = CURDATE()-1 group by date )
, bb as (SELECT date,avg(amount) amount FROM 数据表 where date = CURDATE()-8 group by date )
select aa.amount-bb.amount 同比销售额 from aa,bb
select aa.amount-bb.amount 同比销售额
from (SELECT avg(amount) amount FROM 数据表 where date = CURDATE()-1 ) aa,
(SELECT avg(amount) amount FROM 数据表 where date = CURDATE()-8 ) bb