select a.asi_hora , a.asi_fecha,a.asi_accion,t2.asi_fecha,t2.asi_hora,t2.asi_accion
from asistencia a
join (select *from asistencia where asi_usu_id=(select usu_id from usuario where usu_cedula='0302222096')
and asi_accion='Salida') as t2
where a.asi_usu_id=(select usu_id from usuario where usu_cedula='0302222096')
and a.asi_accion='Entrada' and t2.asi_fecha=a.asi_fecha
and a.asi_hora<t2.asi_hora
order by a.asi_fecha
Hello, I have a problem when performing the following query. I want to visually eliminate marked "X" value, the case is as follows: The query is valid when there are no more than two bearings in one day, but when somebody scores four sometimes they cross more times and can not perform the calculation of the hours correctly any ideas?