Msql-构造当日同比日期

##当期销售金额
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"))#构造当日同比日期
上一篇:tcp_listen函数


下一篇:java读写条形码、二维码