怎么压缩你的case when代码?用ELT( INTERVAL(x, x1,x2,x3,x4) , cat1,cat2,cat3,cat4)
这里,适用于区间都是左闭右开的。如果不是,需要做对应的修改。
(case when duration>=0*60 and duration<5*60 then "[0-5>"
when duration>=5*60 and duration<10*60 then "[5-10>"
when duration>=10*60 and duration<15*60 then "[10-15>"
else "15 or more" end
) as bin
ELT(INTERVAL(duration,0,60*5,60*10,60*15),'[0-5>','[5-10>','[10-15>','15 or more') as bin