update client_info a set a.product_name=(select b.product_name from product_info b where b.product_id=a.product_id)

解决方案 »

  1.   

    报告说 "a 附近有错误"
    我改进了一下:
    update client_info set product_name=b.product_name
    from client_info a, product_info b
    where b.product_id=a.product_id
      

  2.   

    update client_info set product_name=b.product_name
    from client_info a, product_info b
    where b.product_id=a.product_id
    应该可以
      

  3.   

    先问一下使用的数据库是什么? mysql? sqlserver? oracle? 不同数据库实现的时候还是有不一样的.
      

  4.   

    如果是mssql用:update client_info set product_name=(select product_name from product_info where product_info.product_id=client_info.product_id)
      

  5.   

    对,不同的数库不一样的,如果是sql server
    update client_info set product_name=b.product_name
    from client_info a, product_info b
    where b.product_id=a.product_id
      

  6.   

    谢谢各位,我用的是SQLSERVER2000
      

  7.   

    update product_info set product_name=(select product_name from product_info where product_info.product_id=product_id)
      

  8.   

    update CLIENT_info set product_name=(select product_name from product_info where CLIENT_info.product_id=product_id)测试通过