select sta.sta_name,
case when unatt.att_amtype is null then
case when isnull(att.att_amlate,0)>0 then '遲到'
when isnull(att.att_amearly,0)>0 then '早退'
else  '正常'
end
else unatt.att_amtype  
end  ff,
case when unatt.att_pmtype is null then
case when isnull(att.att_pmlate,0)>0 then '遲到'
when  isnull(att.att_pmearly,0)>0 then '早退'
else '正常'
end
else unatt.att_pmtype
end gg
from  att_dutyinfo att 
left join att_unattinfo unatt 
on att.att_did=unatt.att_usid
and convert(varchar(10),unatt.att_udate,120)=convert(varchar(10),att.att_ddate,120)
left join sta on sta_id=att.att_did==================================
用的firebird 2008
在倒数第二行 老通不过。
我去掉“and convert(varchar(10),unatt.att_udate,120)=convert(varchar(10),att.att_ddate,120)”
语句又没问题。怎么改。这个时间关系。这个sql才对