Query to pull Account ID and Site ID (MSSQL & PGSQL)

Query to pull Account ID and Site ID (MSSQL & PGSQL)

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


Go to Reports Tab >> New Query Report and run the below query. 

For Postgres & MS SQL

select adef.org_id "Account ID",
adef.org_name "account",sdef.siteid "Siteid",
sdo.name "Site" from sitedefinition sdef
left join accountsitemapping asm on asm.siteid=sdef.siteid
left join accountdefinition adef on adef.org_id=asm.accountid
left join sdorganization sdo on sdo.org_id=sdef.siteid order by 2

                  New to ADSelfService Plus?