Query to show Account Specific Category, Sub category and Item (MSSQL & PGSQL)

Query to show Account Specific Category, Sub category and Item (MSSQL & PGSQL)

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

SELECT accountdefinition.org_name "Account Name", CategoryDefinition.CATEGORYNAME "Category Name", SubCategoryDefinition.NAME "Sub Category Name" ,ItemDefinition.NAME"Item Name"   FROM CategoryDefinition left join SubCategoryDefinition on  SubCategoryDefinition.CATEGORYID=CategoryDefinition.CATEGORYID  left join ItemDefinition on ItemDefinition.SUBCATEGORYID = SubCategoryDefinition.SUBCATEGORYID left join categoryaccountmapping on categorydefinition.categoryid = categoryaccountmapping.CATEGORYID left join accountdefinition on categoryaccountmapping.accountid=accountdefinition.org_id group by CategoryDefinition.CATEGORYNAME,SubCategoryDefinition.NAME,ItemDefinition.NAME, accountdefinition.org_name order by 1

                  New to ADSelfService Plus?