我新建了两个paradox表(huowei,huowei1),两个表都有同样的字段,stritemname(A),lngpositionid(I),strcustomname(A),strfullname(A),dblendstockquantity(I),pricid(I),
zizoid(I),在程序里利用query写sql语句,用update方法来用一个表更新另一个表的数据,
query2.SQL.Add('update huowei');
query2.SQL.Add('set huowei.pricid=huowei1.pricid,huowei.zizoid=huowei1.zizoid');
query2.SQL.Add('where huowei.stritemname=huowei1.stritemname and huowei.lngpositionid=huowei1.lngpositionid and huowei.strcustomname=huowei1.strcustomname and huowei.strfullname=huowei1.strfullname');
但程序运行的时候老是出现'invaild field name pricid'的错误,请问怎样解决???

解决方案 »

  1.   

    这样写试试看
    update huowei
    set huowei.pricid=huowei1.pricid,huowei.zizoid=huowei1.zizoid
    from huowei,huowei1
    where  huowei.stritemname=huowei1.stritemname and huowei.lngpositionid=huowei1.lngpositionid and huowei.strcustomname=huowei1.strcustomname and huowei.strfullname=huowei1.strfullname
      

  2.   

    to tfxg(土匪):
    不行的,Paradox的UPDATE语句不支持多个表的连接。
      

  3.   

    to 楼主,可以改成这样,我试过可以的。
    update huowei h
    set huowei.pricid=(select pricid from huowei1 h1 where h.stritemname=h1.stritemname and h.lngpositionid=h1.lngpositionid and h.strcustomname=h1.strcustomname and h.strfullname=h1.strfullname),
        huowei.zizoid=(select zizoid from huowei1 h2 where h.stritemname=h2.stritemname and h.lngpositionid=h2.lngpositionid and h.strcustomname=h2.strcustomname and h.strfullname=h2.strfullname)