SELECT u.*, c.*,ch.*
FROM USERINFO AS u INNER JOIN CHECKINOUT AS c ON (u.USERID=c.USERID) INNER JOIN CHECKINOUT AS ch ON (c.CHECKTYPE<>ch.CHECKTYPE) AND (c.USERID=ch.USERID)
WHERE c.CHECKTYPE='I' And c.CHECKTIME Like '7/10/2552*' And ch.CHECKTIME Like '7/10/2552*';