D和R是表T_1中的固有列,T是用case when...then...end as T生成的,现在想在where后面对T的范围进行限制一下,我直接写where T>5,是不可以的,我想问一下有没有类似直接点的写法对T进行判断,没有的话应该怎么办呢?
select D,R,
case when (R/D>=1 and R/D<=1.5 and 0.1*D>=12) then 12 
when (R/D>=1 and R/D<=1.5 and 0.1*D<3.5) then 3.5 
when (R/D>=1 and R/D<=1.5 and 0.1*D>=3.5 and 0.1*D<12) then 0.1*D 
when (R/D>1.5 and R/D<2.88 and (0.198-0.04*R/D)*D/1.38>=3.5 and (0.198-0.04*R/D)*D/1.38<12) then (0.198-0.04*R/D)*D/1.38 
when (R/D>1.5 and R/D<2.88 and (0.198-0.04*R/D)*D/1.38>=12) then 12 
when (R/D>1.5 and R/D<2.88 and (0.198-0.04*R/D)*D/1.38<3.5) then 3.5  
when (R/D>=2.88 and 0.06*D>=3.5 and 0.06*D<12) then 0.06*D 
when (R/D>=2.88 and 0.06*D<3.5) then 3.5 when (R/D>=2.88 and 0.06*D>=12) then 12 end as T 
from T_1
where ...