SQL语句如下:update bw_topics2 set ImpNo =
(
 select ApplyId from bq_quotation a,bw_topics2 b where
 a.topicno=b.topicno and b.iscopyright='是'
 and b.impno is null and a.inputman ='导入'
)
where iscopyright='是' and impno is null
and TopicNo = (select a.Topicno from bq_quotation a,bw_topics2 b
where a.Topicno = b.TopicNo and b.iscopyright='是' and b.impno is null and a.inputman ='导入');排除了表中有相同的记录,为什么还是会报这样的错误!请各位指教...bw_topics2中的TopicNo是主键

解决方案 »

  1.   

    你里面查询的记录有多条  而外面的只返回一条记录 你看把update bw_topics2 set ImpNo in()
      

  2.   

    UPDATE bw_topics2 b set ImpNo =
    (
     select ApplyId from bq_quotation a,bw_topics2 b where
     a.topicno=b.topicno and a.inputman ='导入'
    )
    where iscopyright='是' and impno is null;
      

  3.   

    update tablea a set (tablea字段列表)=
    (select 字段列表 from tableb b where a和b的关联条件)
    where a的限定条件
      

  4.   

    sql是先select出“where a的限定条件”的记录去与表b按“where  a和b的关联条件”取出字段列表,再去更新表a。对照下你原来的sql你就知道自己错哪儿了
      

  5.   

    如果将Where限定条件改为In;中间的那段select ApplyId from bq_quotation a,bw_topics2 b where
     a.topicno=b.topicno and b.iscopyright='是'
     and b.impno is null and a.inputman ='导入'还是会报同样的错误,郁闷啊。怎么改好呢
      

  6.   

    update bw_topics2 set ImpNo =
    (
      select ApplyId from bq_quotation a,bw_topics2 b where
      a.topicno=b.topicno and b.iscopyright='是'
      and b.impno is null and a.inputman ='导入'
    )
    where iscopyright='是' and impno is null
    and TopicNo in (select a.Topicno from bq_quotation a,bw_topics2 b
    where a.Topicno = b.TopicNo and b.iscopyright='是' and b.impno is null and a.inputman ='导入');