I think you should include the chat id
GROUP BY chat_list.key_remote_jid, chat_list.subject, chat_list.creation, chat_list._id
in case 2 chats have the same creation time.
Also, it seems that the chat creation times are not use when showing new chats in UI.
I think you should include the chat id GROUP BY chat_list.key_remote_jid, chat_list.subject, chat_list.creation, chat_list._id in case 2 chats have the same creation time. Also, it seems that the chat creation times are not use when showing new chats in UI.