---
sourceDocument: Brazil ServiceNow AI Platform Capabilities
sourceDocumentLink: https://www.servicenow.com/docs/r/servicenow-platform

 Release :

    - brazil

ft:locale :

    - en-US

ft:publication_title :

    - Brazil ServiceNow AI Platform Capabilities

ft:clusterId :

    - platcap

bundleId :

    - platcap

workflow :

    - Platform


---

# Archive data query examples

# Archive data query examples {#ariaid-title1}

Release version: Brazil  
Updated September 10, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read  
Query examples demonstrate how to combine live and archive data for IT operations reporting, customer service case history, and HR compliance audits.

## IT operations: incident volume and MTTR {#archive-data-query-examples__section-it-operations}

Report on incident volume and MTTR (mean time to resolve) over a rolling three-year period, broken down by priority and assignment group.

    SELECT
        date_trunc('month', opened_at) AS month,
        priority,
        DV(assignment_group) AS group_name,
        COUNT(*) AS incident_count,
        AVG(
            CASE WHEN closed_at IS NOT NULL
            THEN CAST(
                (CAST(closed_at AS FLOAT) - CAST(opened_at AS FLOAT)) * 1440
                AS FLOAT)
            END
        ) AS avg_mttr_minutes
    FROM (
        SELECT opened_at, closed_at, priority, assignment_group
        FROM incident
        WHERE opened_at >= date_trunc('month',
            CAST(NOW() AS DATE) - INTERVAL '36 months')
        UNION ALL
        SELECT opened_at, closed_at, priority, assignment_group
        FROM ar_incident
        WHERE opened_at >= date_trunc('month',
            CAST(NOW() AS DATE) - INTERVAL '36 months')
    ) AS three_year_history
    GROUP BY month, priority, DV(assignment_group)
    ORDER BY month DESC, priority ASC;

## Customer service: full case history for an account {#archive-data-query-examples__section-customer-service}

Return all cases for a specific account over five years, regardless of whether they are still active or have been archived.

    SELECT
        number,
        short_description,
        priority,
        state,
        opened_at,
        closed_at,
        resolved_by,
        'live' AS source
    FROM sn_customerservice_case
    WHERE account = 'Acme Corporation'
      AND opened_at >= '2020-01-01'

    UNION ALL

    SELECT
        number,
        short_description,
        priority,
        state,
        opened_at,
        closed_at,
        resolved_by,
        'archive' AS source
    FROM ar_sn_customerservice_case
    WHERE account = 'Acme Corporation'
      AND opened_at >= '2020-01-01'

    ORDER BY opened_at ASC;

## HR and compliance: employee request history {#archive-data-query-examples__section-hr-compliance}

Return all service requests associated with a specific employee across their full tenure. Because archive tables store resolved display values, filter directly on the display name without resolving a
`sys_id`.

    SELECT
        number,
        short_description,
        category,
        opened_at,
        closed_at,
        state,
        requested_for,
        'live' AS source
    FROM sc_request
    WHERE requested_for = 'Jane Smith'
       OR opened_by = 'Jane Smith'

    UNION ALL

    SELECT
        number,
        short_description,
        category,
        opened_at,
        closed_at,
        state,
        requested_for,
        'archive' AS source
    FROM ar_sc_request
    WHERE requested_for = 'Jane Smith'
       OR opened_by = 'Jane Smith'

    ORDER BY opened_at ASC;


