SELECT * FROM whatsapp_logs WHERE sender_name NOT LIKE '%___whatsApp Business%' AND phone_service_id=? AND message_datetime IN (SELECT MAX(message_datetime) FROM whatsapp_logs WHERE sender_name NOT LIKE '%___whatsApp Business%' AND phone_service_id=? GROUP BY conversation_id) AND conversation_id IS NOT NULL GROUP BY conversation_id ORDER BY message_datetime DESC