问题是这样的,我现在有三个行的id(1,2,3);和三个数据(a,b,c);要使a更新到列名为名字id为1的行里,b更新到id为2的行里

解决方案 »

  1.   

    问题是这样的,我现在有三个行的id(1,2,3);和三个数据(a,b,c);要使a更新到mingzi列,id为1的行里,b更新到mingzi列id为2的行里
      

  2.   

    update tb 
    set mingzi =case id when 1 then 'a' when 2 then 'b' when 3 then 'c' end
      

  3.   

    出现了错误
    不能将值 NULL 插入列 'mingzi',表 'table';列不允许有空值。UPDATE 失败。
      

  4.   

    update tb 
    set mingzi =case id when 1 then 'a' when 2 then 'b' when 3 then 'c' end
    where id in(1,2,3)
      

  5.   

    update tb 
    set mingzi =case id when 1 then 'a' when 2 then 'b' when 3 then 'c' end
    where id in (1,2,3)
    少个空格