Hello, it looks like mariadb has problems in "order by". Following query returns data in wrong order: SELECT l.part_key, l.part_depth, l.part_order, l.is_header, DATE_FORMAT(ph.internal_date,GET_FORMAT(DATETIME,'ISO')), data FROM dbmail_mimeparts p JOIN dbmail_partlists l ON p.id = l.part_id JOIN dbmail_physmessage ph ON ph.id = l.physmessage_id WHERE l.physmessage_id = <ID> ORDER BY l.part_key,l.part_order ASC; I've had headache with my mail server. Switching back to mysql helps.