En metod använder en korrelerad underfråga:
select t.*,
(select count(*)
from test t2
where t2.name = t.name and
t2.start < t.end and
t2.end > t.start
) as num_overlaps
from test t;
En metod använder en korrelerad underfråga:
select t.*,
(select count(*)
from test t2
where t2.name = t.name and
t2.start < t.end and
t2.end > t.start
) as num_overlaps
from test t;