小弟在做一个电子考勤,如果是默认数据 0001/1/1 就显示 无,可是如果不是 000/1/1 不知道如何显示 正常的数据?我的 Time 字段是 datetime类型的,SQL语句里 第2个 then 想直接写字段Time,会说不是时间格式,但是又不能写 'to_date(Time , 'yyyy-mm-dd')' 也会说格式不正确求高人帮忙啊
select case when Time = to_date('0001/1/1', 'yyyy-mm-dd') then '无' when checktimeIn != to_date('0001/1/1', 'yyyy-mm-dd') then '' end Time from Attendance
select case when Time = to_date('0001/1/1', 'yyyy-mm-dd') then '无' when checktimeIn != to_date('0001/1/1', 'yyyy-mm-dd') then '' end Time from Attendance
when to_char(checktimeIn,'yyyy/mm/dd') != '0001/01/01' then ''
end as Time
from Attendance
具体用法百度下。