在Mysql中使用变量
set @num = 1;
select STOREID,CONTACTPHONE,count(*) ARRIVALNUM,CURRENT_DATE COUNTDATE from cater_order_fact whereCONTACTPHONEin (select CONTACTPHONE from crm_dw.cater_order_fact where DATEDIFF(now(),DINNINGTIME) = @num)AND DINNINGTIME > date_sub(CURRENT_DATE ,interval 3 month)group by CONTACTPHONE,STOREID