在Mysql中使用变量

set @num  = 1;
select STOREID,CONTACTPHONE,count(*) ARRIVALNUM,CURRENT_DATE -@num  COUNTDATE from cater_order_fact
where
CONTACTPHONE
in (
select CONTACTPHONE from crm_dw.cater_order_fact where DATEDIFF(now(),DINNINGTIME) = @num
)
AND DINNINGTIME > date_sub(CURRENT_DATE -@num ,interval 3 month)
group by  CONTACTPHONE,STOREID

相关文章:

  • 2022-12-23
  • 2021-07-17
  • 2022-02-11
  • 2022-01-28
猜你喜欢
  • 2021-08-17
  • 2022-02-28
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案