इसे आजमाएं:
(select a.id, a.name, b.name, b.message, a.created_at from a left join b on a.id=b.aid where a.name='John' order by a.created_at desc limit 1)
union all
(select a.id, a.name, b.name, b.message, a.created_at from a left join b on a.id=b.aid where b.name='John' order by a.created_at desc limit 1)