select a.* from messages a
inner join (select conversation_id, max(send_at) as send_at
from messages group by conversation_id) as b
on a.conversation_id = b.conversation_id and a.send_at = b.send_at
where a.conversation_id in ('.implode(',', $conversations_id).')
order by send_at desc
I want to get last message from each conversation in conversations_id
(array) :)Table example: http://ift.tt/2mmvhRj.
Thanks by advance :)
from Latest question asked on Laravel tag.
via HapLifeMan