Query to export All Requesters from All Accounts (MSSQL & PGSQL)

Query to export All Requesters from All Accounts (MSSQL & PGSQL)


Tested in builds from PGSQL (14300) or MSSQL (14306)


Execute the below query under Reports > New Query Reports:  

SELECT AaaUser.USER_ID,AaaUser.FIRST_NAME "FullName",AaaLogin.NAME "LoginName",AaaLogin.DOMAINNAME "Domain",AaaContactInfo.EMAILID "Email",DepartmentDefinition.DEPTNAME "Department",SDOrganization.NAME "Site",ad.org_name"Account",AaaContactInfo.LANDLINE "Phone",SDUser.JOBTITLE "JobTitle",AaaContactInfo.MOBILE "Mobile" FROM AaaUser LEFT JOIN UserDepartment ON AaaUser.USER_ID=UserDepartment.USERID LEFT JOIN AaaUserContactInfo ON AaaUser.USER_ID=AaaUserContactInfo.USER_ID LEFT JOIN AaaContactInfo ON AaaUserContactInfo.CONTACTINFO_ID=AaaContactInfo.CONTACTINFO_ID LEFT JOIN DepartmentDefinition ON UserDepartment.DEPTID=DepartmentDefinition.DEPTID LEFT JOIN SiteDefinition ON DepartmentDefinition.SITEID=SiteDefinition.SITEID LEFT JOIN SDOrganization ON SiteDefinition.SITEID=SDOrganization.ORG_ID INNER JOIN SDUser ON AaaUser.USER_ID=SDUser.USERID LEFT JOIN HelpDeskCrew ON SDUser.USERID=HelpDeskCrew.TECHNICIANID LEFT JOIN AaaLogin ON AaaUser.USER_ID=AaaLogin.USER_ID 
LEFT JOIN accountsitemapping asm ON asm.SITEID=SiteDefinition.SITEID LEFT JOIN accountdefinition ad ON ad.ORG_ID=asm.ACCOUNTID
WHERE  ((HelpDeskCrew.TECHNICIANID IS NULL) AND (SDUser.STATUS = 'ACTIVE')) order by 8,7,1


User the query given below from builds 10600 and above.


SELECT 
  AaaUser.USER_ID, 
  AaaUser.FIRST_NAME "FullName", 
  AaaLogin.NAME "LoginName", 
  AaaLogin.DOMAINNAME "Domain", 
  AaaContactInfo.EMAILID "Email", 
  DepartmentDefinition.DEPTNAME "Department", 
  SDOrganization.NAME "Site", 
  ad.org_name "Account", 
  AaaContactInfo.LANDLINE "Phone", 
  SDUser.JOBTITLE "JobTitle", 
  AaaContactInfo.MOBILE "Mobile" 
FROM 
  AaaUser 
  LEFT JOIN UserDepartment ON AaaUser.USER_ID = UserDepartment.USERID 
  LEFT JOIN AaaUserContactInfo ON AaaUser.USER_ID = AaaUserContactInfo.USER_ID 
  LEFT JOIN AaaContactInfo ON AaaUserContactInfo.CONTACTINFO_ID = AaaContactInfo.CONTACTINFO_ID 
  LEFT JOIN DepartmentDefinition ON UserDepartment.DEPTID = DepartmentDefinition.DEPTID 
  LEFT JOIN SiteDefinition ON DepartmentDefinition.SITEID = SiteDefinition.SITEID 
  LEFT JOIN SDOrganization ON SiteDefinition.SITEID = SDOrganization.ORG_ID 
  INNER JOIN SDUser ON AaaUser.USER_ID = SDUser.USERID 
  LEFT JOIN Portalusers PU ON SDUser.USERID = PU.userid 
  LEFT JOIN portaltechnicians PT ON PU.id = pt.id
  LEFT JOIN AaaLogin ON AaaUser.USER_ID = AaaLogin.USER_ID 
  LEFT JOIN accountsitemapping asm ON asm.SITEID = SiteDefinition.SITEID 
  LEFT JOIN accountdefinition ad ON ad.ORG_ID = asm.ACCOUNTID
WHERE 
  (
    (
      pt.id IS NULL
    ) 
    AND (SDUser.STATUS = 'ACTIVE')
  ) 
order by 
  8, 
  7, 
  1

                  New to ADSelfService Plus?