# Compound query( Targeting Active Accounts)

**URL:** <https://developer.sailpoint.com/discuss/t/compound-query-targeting-active-accounts/107308>\
**Category:** SHF Discussion and Questions\
**Tags:** sailpoint-identity-security\
**Created:** [April 3, 2025, 3:20pm UTC](https://developer.sailpoint.com/discuss/t/compound-query-targeting-active-accounts/107308 "2025-04-03T15:20:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bshilpa2](https://avatars.discourse-cdn.com/v4/letter/b/90db22/32.png) [@bshilpa2](https://developer.sailpoint.com/discuss/u/bshilpa2)\
**Post date:** [April 3, 2025, 3:20pm UTC](https://developer.sailpoint.com/discuss/t/compound-query-targeting-active-accounts/107308/1 "2025-04-03T15:20:07Z")

</div>

query1: Filtering Active Users Across Multiple Sources

There are two sources, Source A and Source B, and a user named ‘X’. X is active in Source A but inactive in Source B. When fetching results, I want to exclude inactive accounts, meaning I only want X’s name to appear for the source where he is active (Source A) and not for the inactive source (Source B).

Additionally, there might be a scenario where another user, ‘Y’, is only present in one source and is inactive in that source. In such cases, I do not want Y’s name to appear at all.

In summary, I only want to retrieve active users and exclude inactive users from both sources.

second query: Is it possible to combine more than five platforms and retrieve only the identities with active accounts?

Below is the query I am using for Five platforms.

@accounts (source.name:‘A’ OR source.name:‘B’ OR source.name:‘C’ OR source.name:‘D’ OR source.name:‘E’) AND (attributes.cloudLifecycleState:active OR attributes.cloudLifecycleState:loa) AND (attributes.C:Y OR attributes.AActive:Y OR attributes.DActive:Y OR attributes.B:2 OR attributes.B:0)

Please help me out for the above queries

---

<div class="post-metadata">

**Author:** ![jesvin90](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jesvin90/32/5301_2.png) [@jesvin90](https://developer.sailpoint.com/discuss/u/jesvin90)\
**Post date:** [April 3, 2025, 3:40pm UTC](https://developer.sailpoint.com/discuss/t/compound-query-targeting-active-accounts/107308/2 "2025-04-03T15:40:57Z")

</div>

Hi @bshilpa2,

To get the active account details alone, you will need to make use of the search [API](https://developer.sailpoint.com/docs/api/v3/search-post) with an [innerhit](https://community.sailpoint.com/t5/IdentityNow-Wiki/How-to-Perform-Searches-with-innerHit-criteria-via-API/ta-p/221973/jump-to/first-unread-message).

Here is a sample API body :

```auto
{
    "indices": [
        "identities"
    ],
    "query": {
        "query": "YOUR QUERY",
        "innerHit": {
            "type": "accounts",
            "query": "disabled:false"
        }
    }
}

```

For your second query - are you facing any issue when you add more than 5 sources.? I believe it should work as long as you have the right query.

---

<div class="post-metadata">

**Author:** ![kdfreeman](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/kdfreeman/32/22737_2.png) [@kdfreeman](https://developer.sailpoint.com/discuss/u/kdfreeman)\
**Post date:** [April 3, 2025, 4:06pm UTC](https://developer.sailpoint.com/discuss/t/compound-query-targeting-active-accounts/107308/3 "2025-04-03T16:06:16Z")

</div>

Can you try .  
`@accounts(disabled:false) && @accounts (source.name:‘A’ OR source.name:‘B’ OR source.name:‘C’ OR source.name:‘D’ OR source.name:‘E’)`

Thanks.

---

<div class="post-metadata">

**Author:** ![bshilpa2](https://avatars.discourse-cdn.com/v4/letter/b/90db22/32.png) [@bshilpa2](https://developer.sailpoint.com/discuss/u/bshilpa2)\
**Post date:** [April 10, 2025, 6:11am UTC](https://developer.sailpoint.com/discuss/t/compound-query-targeting-active-accounts/107308/4 "2025-04-10T06:11:36Z")

</div>

I have remodified the query. However, the query the pulling any data if I add @accounts(disabled: false)

---

<div class="post-metadata">

**Author:** ![rohitmisal45](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/rohitmisal45/32/34069_2.png) [@rohitmisal45](https://developer.sailpoint.com/discuss/u/rohitmisal45)\
**Post date:** [April 10, 2025, 10:10am UTC](https://developer.sailpoint.com/discuss/t/compound-query-targeting-active-accounts/107308/5 "2025-04-10T10:10:57Z")

</div>

Can you try -  
@accounts(disabled:false AND (source.name:“A” OR source.name:“B” OR source.name:“C” OR source.name:“D” OR source.name:“E”))

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [June 9, 2025, 10:11am UTC](https://developer.sailpoint.com/discuss/t/compound-query-targeting-active-accounts/107308/6 "2025-06-09T10:11:13Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
