SQL> SELECT key,count,
DECODE (count, 1, (num+2)/3,
2, (num+1)/3,
3, num/count,
num/count) avg
FROM test
/
K COUNT AVG
- ---------- ----------
a 2 .9
b 1 .9
c 3 1
d 4 1.5
if exists(select count1 from bb1 where count1 >=3)
begin
update bb1 set number = round( number/count1,1)
end;
else if exists(select count1 from bb1 where count1 =2)
begin
update bb1 set number =round((number+1)/3,1)
end;
else update bb1 set number = round((number+2)/3,1)
decimal ld_standard,ld_ratio
dw_edit.AcceptText()
if dwo.name = "standard" or dwo.name = "ratio" then
ld_standard = round(dw_edit.GetItemDecimal(row,"standard"),4)
ld_ratio = round(dw_edit.GetItemDecimal(row,"ratio"),4)
dw_edit.SetItem(row,"ration",Round(ld_standard*ld_ratio,4))
end if
return 1
[@more@]来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/219138/viewspace-918098/ ,如需转载,请注明出处,否则将追究法律责任。