数据库中有个字段值是-1,我想输出时,改为0,可以吗

解决方案 »

  1.   

    --要更新?update 表名  set 字段名=0 where 字段名=-1
      

  2.   

    select case 字段名 when 1 then 0 else 字段名 end from 表名
      

  3.   

    select case when 字段名=-1 then 0 else 字段名 end
    from 表名
      

  4.   

    select (case field1 when -1 then 0 end) as field1
    from table
      

  5.   

    这样?-- 笔误select case 字段名 when -1 then 0 else 字段名 end from 表名
      

  6.   

    select (case field1 when -1 then 0 else field1 end) as field1
    from table