我想在 MYSQL 中检查以下条件。请帮我找到以下情况的解决方案
健康)状况 :
If(fld_intime == null)
{
'InMiss'
}
else if(fld_outtime == null)
{
'Outmiss'
}
else
{
'Present'
}
我如何使用 select 语句创建它..
我想在 MYSQL 中检查以下条件。请帮我找到以下情况的解决方案
健康)状况 :
If(fld_intime == null)
{
'InMiss'
}
else if(fld_outtime == null)
{
'Outmiss'
}
else
{
'Present'
}
我如何使用 select 语句创建它..
SELECT IF(fld_intime IS NULL, 'InMiss', IF(fld_outtime IS NULL, 'Outmiss', 'Present'))
你在找这个吗:
select case when fld_intime is null
then 'InMiss'
when fld_outtime is null
then 'Outmiss'
else 'Present'
end as Remarks
from your_table
SELECT CASE
WHEN fld_intime is null THEN 'InMiss'
WHEN fld_outtime is null THEN 'OutMiss'
ELSE 'Present'
END AS fld_status from yourtable
编写 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;
试试这个::
Select
CASE
WHEN fld_inTime is null
THEN 'InMiss'
WHEN fld_outTime is null
THEN 'outMiss'
ELSE
'Present'
END
from table