MySQL intersection on one table with time type
It seems you need a self join with a non-equality condition that checks for overlaping ranges. The output can be in different formats. Depending on your needs, the easiest would be a 2-column output:

SELECT a.id AS a_id, b.id AS b_id
FROM calendar AS a
  JOIN calendar AS b
    ON  a.id &lt;&gt; b.id
    AND a.timefrom &lt; b.timeuntil
    AND b.timefrom &lt; a.timeuntil 
ORDER BY a.id, b.id ;


Output would be (2 columns):

#1    #2   (the whole day shares the times with morning) 
#1    #3   (the whole day shares the times with afternoon) 
#2    #1   (the morning shares the times with the whole day) 
#3    #1   (the afternoon shares the times with the whole day)


To get the rows combined, you can use GROUP_CONCAT():

SELECT a.id AS a_id, 
       GROUP_CONCAT(b.id ORDER BY b.id SEPARATOR ' ') AS b_ids
FROM calendar AS a
  JOIN calendar AS b
    ON  a.id &lt;&gt; b.id
    AND a.timefrom &lt; b.timeuntil
    AND b.timefrom &lt; a.timeuntil 
GROUP BY a.id
ORDER BY a.id ;


Output (2-columns):

#1    #2 #3   (the whole day shares the times with morning, afternoon) 
#2    #1      (the morning shares the times with the whole day) 
#3    #1      (the afternoon shares the times with the whole day)


If you want one row per a.id and multiple columns, you'll need dynamic SQL.