update table1 set column1=1 where id in (select id from table2 where column2=2);为什么这样执行后,影响结果行数为0? 如果单执行括号里的,返回10条数据

解决方案 »

  1.   

    select count(1) from table1 where id in (select  id from table2 where col1=2);
    先看看这个结果。是不是table1里没有满足?
      

  2.   

    select count(1) from table1 where id in (select id from table2 where column2=2);上边的打错了
      

  3.   

    看一下是不是符合条件的记录column1的值都为1
      

  4.   

    可能的情况
    1.符合集合条件的id在table1里面不存在
    2.存在的id的column1值都为1
      

  5.   

    select * from table1 where id in (select id from table2 where column2=2);看一下,估计根本没有符合条件的记录。
      

  6.   

    或者符合条件的记录中的 column1 已经是1了。