select kqdt.signindate,kqdt.signoutdate,kqdt.signintime ,kqdt.signouttime, FLOOR( datediff(minute,signindate + ' ' + signintime,signoutdate + ' ' + signouttime)/60.0 - 8.0 ) overtime, kqdt.changeType from kq_format_detail kqdt join kq_holidayset kqst on kqdt.signindate = kqst.holidayDate where signindate is not null and signoutdate is not null and signindate <> '' and signoutdate <> '' and FLOOR(datediff(minute,signindate + ' ' + signintime,signoutdate + ' ' + signouttime)/60.0 - 8.0) > 0