Tested in builds PGSQL (14300) or MSSQL (14306)
Tested in builds : 14000, 14201, 14301
1) Query to get the First Name, Last Name, Display Name, Login User ID, Login Name, Email and Phone Number of all users in the application, account-wise, with the accounts arranged in alphabetical order:
SELECT ad.ORG_NAME AS "Account",
sduser.FIRSTNAME AS "First Name",
sduser.LASTNAME AS "Last Name",
aaauser.FIRST_NAME AS "Display Name",
aaauser.USER_ID AS "Login User ID",
al.NAME as "Login Name",
aaacontact.EMAILID AS "E-Mail", aaacontact.LANDLINE AS "Phone" FROM People peopleci
LEFT JOIN BaseElement baseci ON peopleci.CIID=baseci.CIID
LEFT JOIN PortalUsers portalusers ON peopleci.CIID=portalusers.CIID
LEFT JOIN CI ci ON baseci.CIID=ci.CIID
LEFT JOIN AccountSiteMapping asm ON ci.SITEID=asm.SITEID
LEFT JOIN AccountDefinition ad ON asm.ACCOUNTID=ad.ORG_ID
LEFT JOIN SDUser sduser ON portalusers.USERID=sduser.USERID
LEFT JOIN AaaUser aaauser ON sduser.USERID=aaauser.USER_ID
LEFT JOIN AaaUserContactInfo aaausercontact ON aaauser.USER_ID=aaausercontact.USER_ID
LEFT JOIN AaaContactInfo aaacontact ON aaausercontact.CONTACTINFO_ID=aaacontact.CONTACTINFO_ID
LEFT join aaalogin al on aaauser.USER_ID = al.USER_ID order by 1
The above query returns the report in the below mentioned format,
2) Query to include the Employee ID in place of the Display name:
SELECT ad.ORG_NAME AS "Account",
sduser.FIRSTNAME AS "First Name",
sduser.LASTNAME AS "Last Name",
sduser.EMPLOYEEID AS "Employee ID",
aaauser.USER_ID AS "Login User ID",
al.NAME as "Login Name",
aaacontact.EMAILID AS "E-Mail", aaacontact.LANDLINE AS "Phone" FROM People peopleci
LEFT JOIN BaseElement baseci ON peopleci.CIID=baseci.CIID
LEFT JOIN PortalUsers portalusers ON peopleci.CIID=portalusers.CIID
LEFT JOIN CI ci ON baseci.CIID=ci.CIID
LEFT JOIN AccountSiteMapping asm ON ci.SITEID=asm.SITEID
LEFT JOIN AccountDefinition ad ON asm.ACCOUNTID=ad.ORG_ID
LEFT JOIN SDUser sduser ON portalusers.USERID=sduser.USERID
LEFT JOIN AaaUser aaauser ON sduser.USERID=aaauser.USER_ID
LEFT JOIN AaaUserContactInfo aaausercontact ON aaauser.USER_ID=aaausercontact.USER_ID
LEFT JOIN AaaContactInfo aaacontact ON aaausercontact.CONTACTINFO_ID=aaacontact.CONTACTINFO_ID
LEFT join aaalogin al on aaauser.USER_ID = al.USER_ID order by 1