SELECT emails.id polymorphic_id, 'Emails' polymorphic_module FROM emails
								   JOIN emails_text on emails.id = emails_text.email_id
                                   WHERE (type = 'inbound' OR status = 'inbound') AND assigned_user_id = '6625f082-60b4-af8c-9805-58410f759379' AND emails.deleted = '0' AND status NOT IN ('sent', 'archived', 'draft') AND type NOT IN ('out', 'archived', 'draft')