select
        post,
        round(avg(work_time),3) as work_hours
from (
    select
        s_tb.staff_id,
        s_tb.post,
        timestampdiff(minute,first_clockin,last_clockin) /60 as work_time
    from 
            staff_tb as s_tb
    left join 
            attendent_tb as a_tb
    on 
            s_tb.staff_id = a_tb.staff_id
    where 
            first_clockin is not null 
    and
            last_clockin is not null
)a
group by post
order by work_hours desc