最后10分了,SQL SERVER 2000中有一表名为table,字段Status,如果Status=0,则为'未审核',如果1,则为'已经审核',为-1,则为'作废单据',问如何用select ? from table 将读到的0、1、-1显示为"未审核"、"已经审核"、" 作废单据".

解决方案 »

  1.   

    select (case status 
                 when 0 then '未审核'
                 when 1 then '已经审核'
                 when -1 then '作废单据'
            end) As Status
    from table
      

  2.   

    select case Status when '0' then '未审核' when '1' then '已经审核' else '作废单据' end Status from table
      

  3.   

    再建一个表用来保存Status与“已审核”等数据的对应关系。假设这个表名为Table1,包括两个字段StatusID、Status,StatusID对应于Table表中的Status字段,则查询语句为:
    select [table].[Field],…………,[table1].[Status] from [table] inner join [table1] on [table].[status]=[table1].[statusid] where …………