SELECT
 json_extract(m.value, '$.conversationId') as ConversationId,
 json_extract(m.value, '$.sequenceId') as SequenceId,
 json_extract(m.value, '$.content') as Content,
 json_extract((select p.Value from IndexedDbRecords p where p.Key = '"' || json_extract(m.value, '$.creator') || '"'), '$.emailsInfo[0].address')  as CreatorEmail,
 json_extract((select p.Value from IndexedDbRecords p where p.Key = '"' || json_extract(m.value, '$.creator') || '"'), '$.displayName')  as CreatorDisplayName,
    DATETIME(ROUND(json_extract(m.value, '$.clientArrivalTime')/1000), 'unixepoch') as ClientArrivalTime
FROM
 IndexedDbRecords r, json_each(json_extract(r.Value, '$.messageMap')) m
WHERE
 ObjectStoreName = 'replychains' 
ORDER BY
 ConversationId, SequenceId