我有类似的东西
@CucumberOptions(features = "scenarii/connexion/", glue = {
"cucumber.tests, "org.includeProject.cucumber"}
)
我可以为公式CASE
WHEN (1-(DayDiff([END_DATE],[START_DATE])*0.01)) >= 1.5 THEN
1.5
WHEN (1-(DayDiff([END_DATE],[START_DATE])*0.01)) <=0 THEN
0
ELSE
(1-(DayDiff([END_DATE],[START_DATE])*0.01))
END
使用别名吗?
而不是多次使用它?
当公式返回(1-(DayDiff([END_DATE],[START_DATE])*0.01))
时,我也希望将值设为0。
答案 0 :(得分:1)
您可以为计算字段指定别名,并在外部查询中使用该别名。例如;
select
CASE WHEN calc_field >= 1.5 THEN 1.5
WHEN calc_field <=0 THEN 0
ELSE calc_field
END result
from (
select (1-(DayDiff([END_DATE],[START_DATE])*0.01)) calc_field
from table
) K