Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Analytic Query for fetching list of account with entitlement not assigned to respective account

sumit_morchhale
New Contributor
New Contributor

I want to fetch the list of account and entitlement not assigned to respective account.
Example:-
There are 4 entitlement(Ent1,Ent2,Ent3,Ent4) in endpoint and 2 account(Acc1,Acc2) in an Endpoint E1.
Ent1 is already assigned to Acc1,
Ent 2 is already assigned to Acc2.
There are also 3 entitlement(Ent5,Ent6,Ent7) in endpoint and 2 account(Acc3,Acc4) in an Endpoint E2.
Ent5 is already assigned to Acc3,
Ent 6 is already assigned to Acc4.


Then desired list/output is from analytic should be  (The desired list/output is not for specific endpoint ,it should contain list for all endpoint's account and entitlement )
Acc1, Ent2
Acc1,Ent3
Acc1, Ent4
Acc2,Ent1
Acc2,Ent3,
Acc2,Ent4.
Acc3, Ent6
Acc4,Ent7
Acc3,Ent5,
Acc4,Ent7.

Query:-select ev.entitlement_value,a.name,u.firstname,u.lastname from entitlement_values ev left join account_entitlements1 ae on ae.entitlement_valuekey=ev.entitlement_valuekey left join accounts a on a.accountkey=ae.accountkey inner join endpoints e on e.endpointkey=a.endpointkey inner join user_accounts ua on ua.accountkey=a.accountkey right join users u on u.userkey=ua.userkey.

'This above query is not returning desired output'. Please check this query and suggest me if anything is required.

 

1 REPLY 1

rushikeshvartak
All-Star
All-Star

SELECT A.NAME               AS ACCOUNT_NAME,
       E.NAME               AS ENDPOINT_NAME,
       EV.entitlement_value AS ENTITLEMENT
FROM   accounts A
       JOIN endpoints E
         ON A.endpointkey = E.endpointkey
       CROSS JOIN entitlement_values EV
       LEFT JOIN account_entitlements1 AE
              ON AE.entitlement_valuekey = EV.entitlement_valuekey
                 AND AE.accountkey = A.accountkey
WHERE  AE.accountkey IS NULL 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.