MySQL Subquery count
You can't reference depot_resource in the outer query, it is out of scope.
You need to join the tables, and group by name to get the aggregate. 
Since you didn't provide DDL and sample data, we can only guess, but maybe you need something like this?

SELECT j.name, COUNT(*) AS rescount
FROM transit as j 
     INNER JOIN 
     depot_resource as m 
     on j.scheduled_time between m.actual_start and m.actual_end
GROUP BY j.name


Something seems odd here as there is no correlation to j.name in depot_resource, but without the table structure and the expected result we can't really tell.

HTH