日期:2014-05-16 浏览次数:20470 次
declare @coefficient_value float
update T_2013_12 set @coefficient_value=power((T_2013_12.interm_1-range_rule.min_2013)/(range_rule.max_2013-range_rule.min_2013),1.4)*40+60
from T_2013_12
inner join range_rule
on T_2013_12.index_id = range_rule.index_id
UPDATE T_2013_12 SET evaluate_mark_2013_1court =
case when T_2013_12.variation_char=1 and T_2013_12.interm_1>range_rule.min_2013 then 60
when T_2013_12.variation_char=2 and T_2013_12.interm_1<range_rule.min_2013 then 60
else( case when @coefficient_value<60 then 60
when @coefficient_value>100 then 100
else @coefficient_value end)
end
from T_2013_12
inner join range_rule
on T_2013_12.index_id = range_rule.index_id
--变量赋值
select @coefficient_value=power((T_2013_12.interm_1-range_rule.min_2013)/(range_rule.max_2013-range_rule.min_2013),1.4)*40+60 from T_2013_12 inner join range_rule on T_2013_12.index_id = range_rule.index_id
;with cte as
(
select a.index_id,b.min_2013,
power((a.interm_1 - b.min_2013)
/(a.max_2013 - b.min_2013),1.4)*40+60 as iscontrl
from T_2013_12 a inner join range_rule b
on a.index_id = b.index_id
)
update a
set a.evaluate_mark_2013_1court =
case when a.variation_char= 1 and a.interm_1 > b.min_2013
then 60
when a.variation_char = 2 and a.interm_1 < b.min_2013
then 60
else(case when b.iscontrl<60
then 60
when b.iscontrl>100
then 100
else b.iscontrl end)
&