select subject, owner_id from messages_messages where msg_id = :msg_id and community_id = :community_id select messages.msg_id from (select max(m.msg_id) as last_msg_id, m.parent_id as msg_id, count(m.msg_id) as number_conversation from (select msg_id, coalesce(parent_id,msg_id) as parent_id from messages_messages where community_id = :community_id and msg_id in (select parent_id from messages_user_messages where user_id = :user_id and folder_id = :folder_id)) m group by m.parent_id order by last_msg_id desc) messages select max_messages from messages_options where user_id = :user_id select attachment_id from messages_attachments where msg_id in (select msg_id from messages_messages where community_id = :community_id and parent_id = :msg_id or msg_id = :msg_id) select crr.title as content, crr.title, crr.item_id, cri.storage_type, crr.revision_id, crr.content_length, crr.mime_type, crr.title from cr_items cri, cr_revisions crr where crr.revision_id = :attachment_id and crr.item_id = cri.item_id select count(*) from messages_user_messages where user_id = :user_id and parent_id = :msg_id select $rel_type_case as rel_type from acs_rels where object_id_one = :community_id and object_id_two = :owner_id