luojian0323 回复 木木初报道(提问者)区间分组要写在sql中
不然后面的字段不能根据这个区间分组显示。因为你这个区间分组字段是分组显示的。
select
case when days(\'$日期参数\')-days(last_order_date)<30 then \'1个月内未下单\'
when days(\'$日期参数\')-days(last_order_date)>=30 and days(\'$日期参数\')-days(last_order_date)< 61 then \'1个月-2个月内未下单\'
when days(\'$日期参数\')-days(last_order_date)>=61 and days(\'$日期参数\')-days(last_order_date)<180 \'2个月以上未下单\'
when days(\'$日期参数\')-days(last_order_date)>=180 then \'半年以上未下单\'
end 区间分组
,其他字段
from 表名