Código SQL:
Ver originalSELECT P.*
FROM PARTESTRABAJO P
INNER JOIN ASISTENCIAS A ON P.CodigoTrabajador = A.CodigoTrabajador AND P.Fecha = A.Fecha
WHERE CAST(P.HoraFin AS DATETIME) NOT BETWEEN CAST(A.HoraInicio AS DATETIME) AND CAST(A.HoraFin AS DATETIME)
AND CAST(P.HoraInicio AS DATETIME) BETWEEN CAST(A.HoraInicio AS DATETIME) AND CAST(A.HoraFin AS DATETIME)
AND CAST(P.HoraFin AS DATETIME) > CAST(A.HoraFin AS DATETIME)
AND P.CodigoTrabajador = 'ERIC'
AND P.Fecha = '20090710'