0

我想在 MYSQL 中检查以下条件。请帮我找到以下情况的解决方案

健康)状况 :

If(fld_intime == null)
{
    'InMiss' 
}
else if(fld_outtime == null)
{
   'Outmiss'
}
else 
{
    'Present'
}

我如何使用 select 语句创建它..

4

5 回答 5

1
SELECT IF(fld_intime IS NULL, 'InMiss', IF(fld_outtime IS NULL, 'Outmiss', 'Present'))
于 2012-07-09T09:22:18.737 回答
0

你在找这个吗:

select case when fld_intime is null 
            then 'InMiss'
            when fld_outtime  is null 
            then 'Outmiss'
            else 'Present'
       end as Remarks
from your_table
于 2012-07-09T09:19:02.650 回答
0
SELECT CASE 
        WHEN fld_intime is null THEN 'InMiss'
        WHEN fld_outtime is null THEN 'OutMiss'
        ELSE 'Present'
    END AS fld_status  from yourtable
于 2012-07-09T09:22:15.240 回答
0

编写 sql examplee .. 在 where 查询中使用Case语句

select 
      case when fld_intime is null then 'InMiss' 
           when fld_outtime is null then 'Outmiss' 
      else 'Present' end
from yourTable;
于 2012-07-09T09:22:37.253 回答
0

试试这个::

Select 
 CASE

 WHEN fld_inTime is null
  THEN 'InMiss' 
WHEN fld_outTime is null
THEN 'outMiss' 
ELSE
'Present'
END
from table
于 2012-07-09T09:22:49.063 回答