The SQL:
select distinct
h.teacher_id,
h.last_updated_at,
c.name
from sometable h
inner join class c on h.teacher_id=c.id
where last_updated_at is not null
order by last_updated_at desc limit 5;
I'm getting duplicate teacher_id
in response. Where am I going wrong? I wanted to return last updated teacher name and id.