我要实现的功能是这样的:
有两个表:table1  字段:s1,arf
          table2  字段:ss,sums
现在希望对table1更新数据:
    如果table1.s1=table2.ss
    那么更新为:table1.arf=table1.arf/table2.sums
我是这样写的:
 update table1 
 set table1.arf=table1.arf/table2.sums 
 where table1.s1 in (select ss from table2)
一运行就报错:说invalid fieldname:sums
什么问题阿

解决方案 »

  1.   

    table1.arf=table1.arf/table2.sums 这句还能确保数据类型一致吗?
      

  2.   

    table1.arf和table2.sums 都是number型阿
      

  3.   

    update table1 
     set table1.arf=table1.arf/table2.sums 
     from table1,table2 
     where table1.s1 in (select ss from table2)注意 from 
      

  4.   

    加上from 后不报前面这个错了,但是from又通不过了
    说:invalid use of keyword :from
    update后面能跟from吗?
      

  5.   

    这样一定OK,
    Update table1 set  arf=arf/(select table2.sums from table2
    where table1.s1=tble2.ss)
    上一句可能在错,
    说invalid fieldname:sums,说明 Table2中无此字段,请再仔细查一下吧!
    下次问问题时记偏住给点分..............
      

  6.   

    update table1 set arf=table1.arf/table2.sums from table1,table2
    where table1.s1=table2.ss
      

  7.   

    update table1 
     set arf=table1.arf/table2.sums 
     from table1,table2 
     where table1.s1=table2.ss