Я понимаю, что примерно так и должно работать... Весь вопрос именно в том, как его реализовать в коде, т.к. в SQL я тоже не силен, к сожалению. Но в любом случае спасибо Вам большое
select Personal_Number,
Assistance_Surname,
Assistance_Name,
Assistance_Patronymic,
Permit_Number , Pass_Kind, (t2.COUNT-t1.COUNT) as Working_Time from (select t1.Personal_Number, t1.Assistance_Surname, t1.Assistance_Name, t1.Assistance_Patronymic, t1.Permit_Number, t1.Pass_Kind as t1 t2.Personal_Number, t2.Assistance_Surname, t2.Assistance_Name, t2.Assistance_Patronymic, t2.Permit_Number, t2.Pass_Kind as t2
from ((select * from Date_Pass where Pass_Kind='exit') union
(select * from Date_Pass where Pass_Kind='enter')) as t) where t1.Personal_Number=t2.Personal_Number AND t1.Assistance_Surname=t2.Assistance_Surname AND
t1.Assistance_Name=t2.Assistance_Name AND t1.Assistance_Patronymic=t2.Assistance_Patronymic AND
t1.Permit_Number=t2.Permit_Number AND t1.Pass_Kind=t2.Pass_Kind