##当期销售金额
select
SUM(ls.sale_amount)
from test_sale_amount ls
where
ls.order_date>="2021/11/1"
and ls.order_date<=CURDATE()
##同比期销售金额
select
SUM(ls.sale_amount)
from test_sale_amount ls
where
ls.order_date>="2020/11/1"
and ls.order_date<=concat("2020/11/",date_format(curdate(),"%d"))#构造当日同比日期
相关文章
- 03-06Msql-构造当日同比日期