Employee as e1 left JOIN (select id, max(Month) max_Month from Employee group by Id ) as e2 on e1.id = e2.id and e1.Month = e2.Max_Month