To get a list of jobs that were running during the execution of another job you can use a simple join:
declare @job varchar(100) = 'main'
select b.*
from COMP_HIS_TBL a
inner join COMP_HIS_TBL b
on b.Start_Time <= a.End_Time
and b.End_Time >= a.Start_Time
and b.Job_name <> a.Job_Name
where a.Job_name = @job
a is the main job,
b are all the other jobs that were running during that time. You just need to compare the start and end times. Please note that this gets more complicated if you consider null values, jobs that didn't finish yet for example.
Here is the
SQL Fiddle[
^].