ITPub博客

首页 > 数据库 > 数据库开发技术 > sql

sql

原创 数据库开发技术 作者:abcbbc 时间:2007-06-08 13:45:11 0 删除 编辑

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/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: code
请登录后发表评论 登录
全部评论

注册时间:2011-09-07

  • 博文量
    56
  • 访问量
    699643