select case 字段名 when 0 then '进' when 1 then '出' end from tb
select case when 字段=0 then N'进' ELSE N'出' end
case when Inout=1 then '进' esle '出' end
select 1-字段 from tb
select case Inout when 0 then '进' else '出' end from tb
select replace(replace(Inout ,0,'进'),1,'出')
表里还有其它字段也要查出呢; 并且inout 有0,1,2,3几种情况;字段有 name inout time
select case Inout when 0 then '进' else '出' end,name,inout ,time from tb 呗
多谢大家,在大家启发下亲自测试得出如下,都可以,我的数据库中inout是自符形的SELECT Time, name, (CASE InOut WHEN '0' THEN '进' WHEN '1' THEN '出' WHEN '2' THEN '进无效' when '3' then '出无效' END) FROM table1或SELECT Time, name, (CASE InOut WHEN 0 THEN '进' WHEN 1 THEN '出' WHEN 2 THEN '进无效' when 3 then '出无效' END) FROM table1
select case 字段名 when 0 then '进' when 1 then '出' end
from tb
case when Inout=1 then '进' esle '出' end
并且inout 有0,1,2,3几种情况;字段有 name inout time
(CASE InOut WHEN '0' THEN '进' WHEN '1' THEN '出' WHEN '2' THEN '进无效' when '3' then '出无效' END)
FROM table1或SELECT Time, name,
(CASE InOut WHEN 0 THEN '进' WHEN 1 THEN '出' WHEN 2 THEN '进无效' when 3 then '出无效' END)
FROM table1