Bueno al final he decidido por hacer un procedimiento con 2 cursores analizando asi todas las combinaciones, igualmente si hay alguna forma de hacerlo mejor decirmelo.
Os dejo el codigo que he realizado:
Código MySQL:
Ver original-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
OPEN cur1;
read_loop: LOOP
FETCH cur1
INTO Idc
,Asignedc
,StartTimec
,EndTimec
; LEAVE read_loop;
and Id
!=Idc
and StartTimec
<=StartTime
and EndTimec
>=StartTime
and Id
not in (IdComp
); OPEN cur2;
read_loop2: LOOP
FETCH
FROM cur2
INTO Id2c
,Asigned2c
,StartTime2c
,EndTime2c
; CLOSE cur2;
LEAVE read_loop2;
CLOSE cur1;
Saludos y gracias por todo.