Query to show which Accounts were last sync’d (MSSQL & PGSQL)

Query to show which Accounts were last sync’d (MSSQL & PGSQL)

Tested in Build PGSQL (14300) or MSSQL (14306)


Please go to Reports- New Query Report and execute this query.

select org_id,
org_name as "Account",
case when org_id in
    (select distinct ADef.org_id FROM ADOrganizationalUnits ADOU LEFT JOIN ADOUsRelationInfo ADRI ON ADOU.OUID=ADRI.OUID
    LEFT JOIN SharedDomainOUmapping sdom on adou.ouid=sdom.ouid
    LEFT JOIN SharedDomainaccmapping sdam on sdam.mappingid=sdom.oumappingid
    LEFT JOIN AccountDefinition ADef on sdam.accountid=ADef.org_id
    WHERE ADOU.ISUSERSIMPORTED = 'true') then 'YES' else '' end as "Sync'd"
from AccountDefinition
order by org_name


                  New to ADSelfService Plus?

                    • Related Articles

                    • Query to show technicians associated accounts, sites and Support groups - (MSSQL & PGSQL)

                      Tested in Build PGSQL (14300) or MSSQL (14306) 1.Technicians and associated Accounts/Sites: select aau.User_id, aau.first_name "First Name", sdu.lastname "Last Name", aal.name "Login Name", AaaContactInfo.EMAILID "Email Address",sdu.jobtitle "Job ...
                    • Query to show the last worklog added in a ticket (PGSQL)

                      Tested in build PGSQL (14300) PGSQL: SELECT wo.WORKORDERID "Request ID", max(aau.FIRST_NAME) "Requester", max(wo.TITLE) "Subject", max(qd.QUEUENAME) "Group", max(ti.FIRST_NAME) "Assigned Technician", CAST(ct.TIMESPENT AS FLOAT)/1000/3600 AS "Time ...
                    • Query to show Last added worklog of a ticket ( MSSQL )

                      Tested in build MSSQL (14306) MSSQL: SELECT wo.WORKORDERID AS "Ticket Number", pd.PRIORITYNAME AS "Priority", cd.CATEGORYNAME AS "Category", qd.QUEUENAME AS "Group", ti.FIRST_NAME AS "Technician", aau.FIRST_NAME AS "Requester", Wo.title "Subject", ...
                    • Query to show last updated field (MSSQL & PGSQL)

                      Tested in Build PGSQL (14300) or MSSQL (14306) Kindly go to Reports-New Query Report and execute the below query. PGSQL: SELECT wo.WORKORDERID AS "Request ID", max(wo.TITLE) AS "Subject", max(ti.FIRST_NAME) AS "Assigned Technician", ...
                    • Query to show Average response time for Category (MSSQL & PGSQL)

                      Tested in build PGSQL (14300) and MSSQL (14306) PGSQL: SELECT accountdefinition.org_name "Account",cd.categoryname "Category", TO_CHAR(((avg(wo.respondedtime)-avg(wo.createdtime))/1000 || ' second')::interval, 'HH24:MI:SS') "Avg Response Time" FROM ...