表 A 里有一个字段 status , status 只有 0,1 两种状态。0代表有效,1代表无效怎么样用 sql 语句直接显示有效或无效而不是0或1?

解决方案 »

  1.   

    select (case t.status when '0' then '有效'  when '1' then '无效' end ) as status from  A t我试出来了
      

  2.   

    select decode(status, 0,'有效',1,'无效',null) from a
      

  3.   

    select decode(status, 0,'有效','无效') from a
      

  4.   

    select decode(status, 0,'有效',1,'无效') from a;
      

  5.   

    SELECT DECODE(status,1,'无效', 0,'有效') FROM A;