mysql设置变量

-- 销售详情单和库存日志对比查询
set @month_start= '2020-11-01 00:00:01' , @month_end= '2020-11-31 23:59:59';
select count() from fa_stocklog_v where big_goodsid = 904012 and billDate >= @month_start and billDate <= @month_end and type = 0 and status =1 and warehouseid = 7 and billType ='XS'
select sum(cost
qty) from fa_stocklog_v where big_goodsid = 904012 and billDate >= @month_start and billDate <= @month_end and type = 0 and status =1 and warehouseid = 7 and billType ='XS'

原文地址:https://www.cnblogs.com/ianlab/p/14097140.html