Asset Management Suite

 View Only
  • 1.  SQL Query to relate User to Manager

    Posted Sep 02, 2014 05:00 PM

    Hello All,

    I am sure this is simple, but for the life of me I cannot find where the Manager relationship to a User is located in the SQL database (7.1)

    Does someone have a simple join statement to relate a user to the manager in their User Profile?



  • 2.  RE: SQL Query to relate User to Manager

    Posted Sep 03, 2014 06:52 AM

    Hi,

    Here is a simple query:

    select  usr.Name as 'User Name', mng.Name as 'Manager'  
    from RM_ResourceUser usr
    join ResourceAssociation pr ON usr.Guid = pr.ParentResourceGuid
    join RM_ResourceUser mng on pr.ChildResourceGuid = mng.Guid

    Thanks,

    AN



  • 3.  RE: SQL Query to relate User to Manager

    Posted Sep 03, 2014 12:18 PM

    The results were inconsistant.

    Some results were managers, some results were "Direct Report's".



  • 4.  RE: SQL Query to relate User to Manager
    Best Answer

    Posted Sep 04, 2014 03:49 AM

    Try this one

    select  usr.Name as 'User Name', mng.Name as 'User Manager'  
    from RM_ResourceUser usr
    join ResourceAssociation pr ON usr.Guid = pr.ParentResourceGuid
    join RM_ResourceUser mng on pr.ChildResourceGuid = mng.Guid
    where ResourceAssociationTypeGuid = '049c633f-8413-42ae-93ea-f4eb7edafc65'