表如下TABLE1
colIsAdmin    bit    not null查询:SELECT * FROM Table1 的结果如下:colIsAdmin
0
0
0
1
1
0我想让结果显示为:colIsAdmin
不是管理员
不是管理员
不是管理员
管理员
管理员
不是管理员这个sql咋写?谢谢了~~

解决方案 »

  1.   

    select case when colIsAdmin=0 then '不是管理员' else 管理员 end as colIsAdmin from Table1
      

  2.   

    select case when colIsAdmin=0 then '不是管理员' else 管理员 end as colIsAdmin from Table1
      

  3.   

    select case colIsAdmin when 0 then '不是管理员' when 1 then '管理员' end as colIsAdmin from Table1
      

  4.   

    select case when colIsAdmin=0 then '不是管理员' 
           when colIsAdmin=0 then '管理员' 
           else '非法数据' end 
       as colIsAdmin from Table1
      

  5.   

    恶搞一个
    select isnull(nullif(replace(colIsAdmin,'0','不是'),'1'),'') + '管理员' from tb
      

  6.   

    select (case when colIsAdmin=0 then '不是' else '' end)+'管理员' as colIsAdmin from Table1缩短sql语句,增加执行时间  哈哈
      

  7.   

    fcuandy(猪头年年有,近期特别多) 
    搞的有理~~~
    支持你一下,哈哈!
      

  8.   

    select convert(varchar(50),case colIsAdmin when 0 then '不是管理员' when 1 then '不是管理员') from TABLE1
      

  9.   

    select case colIsAdmin when 0 then '不是管理员' when 1 then '管理员' end  from TABLE1
      

  10.   

    来晚了.
    select case when colIsAdmin=0 then '不是管理员' else '管理员' end as colIsAdmin from Table1
      

  11.   

    create  table  Table1
           (colIsAdmin  char(10)) 
    go  
     
    insert  into  table1(colIsAdmin)  values(0)  
    insert  Table1 values(0)  
    insert  Table1 values(0)  
    insert  Table1 values(1)
    insert  Table1 values(1)
    insert  Table1 values(0)select case when colIsAdmin=0 then '不是管理员' else '管理员' end as colIsAdmin from Table1
      

  12.   

    select colIsAdmin= case when colIsAdmin=0 then '不是管理员' else '管理员' end  from Table1
    杂都没这样写的内?