当前位置: 代码迷 >> 其他数据库 >> Interbase中Select case 如何用
  详细解决方案

Interbase中Select case 如何用

热度:6895   发布时间:2013-02-26 00:00:00.0
Interbase中Select case 怎么用?
想实现如下的功能,但是调试总出错

select D,R,ZD,
case( 
when R/D>=1 and R/D<=1.5 then 0.1*D 
when R/D>1.5 and R/D<2.88 then (0.198-0.04*R/D)*D/1.38 
when R/D<=2.88 then 0.06*D end 
)as t from ZDXWGJ

求帮助!

------解决方案--------------------------------------------------------
试试
select D,R,ZD,
case
when R/D>=1 and R/D<=1.5 then 0.1*D
when R/D>1.5 and R/D<2.88 then (0.198-0.04*R/D)*D/1.38
when R/D<=2.88 then 0.06*D end as t from ZDXWGJ
------解决方案--------------------------------------------------------
select D,R,ZD,
(case
when R/D>=1 and R/D<=1.5 then 0.1*D
when R/D>1.5 and R/D<2.88 then (0.198-0.04*R/D)*D/1.38
when R/D<=2.88 then 0.06*D end
)as t from ZDXWGJ
  相关解决方案