Find Number of Records Higher Than A Specific Number In Other Table
I'm sorry if it is not well formatted but I'm on mobile.

You can get it by counting attended courses and getting those records where total is lower.

select id, name, total_couses_allowed
from table1
inner join (select emp_id, count(*) as courses
            from table2
            where course_attended = 't'
            group by emp_id) t2
on table1id = t2.emp_id
where total_courses_allowed &lt; courses