I am trying to figure out how to get the latest chat message from every group
I have group table that has objectId and GroupMsges with 1:N relationships with Message Table.
The message table has ObjectId, From(User), To(User), Msg, and the created date
I want to get the latest message from every group that is destined to me. How can I achieve that.
Something like Get me the last message from every group where Message.To.objectId = ‘xyz’
Preferable if I can get the Group objectId along with the message details in one query. If not then just the message details is ok.
Can you advise how?