3个表a表:
aid
ascore
*******************************************b表:
bid
bpei********************************************c表:
bid
aid
cscore麻烦开始了:如何实现这个update
ascore +=  bpei * cscore

解决方案 »

  1.   

    update A
    set Ascore=cscore +bpei*cscore
    FROM A JOIN C ON A.AID=C.AID 
    JOIN B ON C.BID=B.BID
      

  2.   

    update A
    set Ascore=ascore+bpei*cscore
    FROM A JOIN C ON A.AID=C.AID 
    JOIN B ON C.BID=B.BID修改一楼的
      

  3.   

    update a set a.score=(
    select b.bpei*c.cscore from a,b,c
    where a.aid=b.bid=c.cid)
      

  4.   

    update c
    set ascore = isnull((select bpei from b where aid = a.aid),0) + isnull((select ascore from b where bid = a.bid),0)
    from c
      

  5.   

    update 
      a 
    set 
      ascore=ascore+b.bpei*c.cscore 
    from
      a,b,c
    where 
      a.aid=c.aid
    and
      b.bid=c.bid
      

  6.   

    修改下
    update a set a.ascore=b.bpei*c.cscore
    from (select a.ascore,b.bpei,c.cscore from a,b,c where a.aid=b.bid=c.cid) t
      

  7.   

    4楼错了,应该是:update a
    set ascore = (select b.bpei * c.cscore from b , c where b.bid = c.bid and c.aid = a.aid)
    from a
      

  8.   


    错误
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to 
      

  9.   


    MYSQL的 不会哦  有请小梁
      

  10.   


    对啊,是MYSQL的,怎么搞呢?
      

  11.   

    mysql的,试试:update a
    set ascore = (select b.bpei * c.cscore from b , c where b.bid = c.bid and c.aid = a.aid)
    from a
      

  12.   


    谢谢dawugui,但是存在一点问题,稍微修改一下,正确语句是
    set ascore = ascore + (select b.bpei * c.cscore from b , c where b.bid = c.bid and c.aid = a.aid)
    结贴!
      

  13.   

    不好意地,修改楼上
    update a set ascore = ascore + (select b.bpei * c.cscore from b , c where b.bid = c.bid and c.aid = a.aid)
      

  14.   


    ---这个可以不?
    update 
      a 
    set 
      ascore=ascore+b.bpei*c.cscore 
    from
      a,b,c
    where 
      a.aid=c.aid
    and
      b.bid=c.bid
      

  15.   

    如果是oracle,肯定不行.MYSQL不知道.