insert into A set operator='cxm',opername='陈总',corporationID=(select corporationID from B where c_level='1')

解决方案 »

  1.   

    谢谢你的回复!不过好象行不通啊!朋友。结果说“在关键字 'set' 附近有语法错误。”
      

  2.   

    是mysql数据库吗?在mysql4.0,5.0下均可以正确执行的。
    你还可以这样写:insert into A (operator,opername,corporationID) select 'cxm','陈总',corporationID from B where c_level='1';
      

  3.   

    我用户的数据库是Microsoft SQL Server2000,我只要corporationID数据从B表中得到。谢谢!
      

  4.   

    insert into A (operator,opername,corporationID) select 'cxm','陈总',corporationID from B where c_level='1';
      

  5.   

    谢谢!没错这样是可以:
    insert into A (operator,opername,corporationID) select 'cxm','陈总',corporationID from B where c_level='1';
    但我那operator和opername是不要B表中,只有corporationID才在B表中!那该怎么写呢?
      

  6.   

    呵呵!插入a表中operator和opername字段的数据,不是B表中的。是'cxm','陈总',你试试就知道了。