mysql - sum interval dates
You could merge overlapping intervals and count the hours from there (untested):

select name, min(start), end 
from (
    select x.name, x.start, min(y.end) as end 
    from t as x 
    join t as y 
        on x.name = y.name 
       and x.start &lt;= y.end 
       and not exists (
           select 1 
           from t as z 
           where y.name = z.name 
             and y.end &gt;= z.start 
             and y.end &lt; z.end
       ) 
    where not exists (
        select 1 
        from t as u 
        where x.name = u.name 
          and x.start &gt; u.start 
          and x.start &lt;= u.start
    ) 
    group by x.name, x.start
) as v group by name, end;