SELECT categorydefinition.CATEGORYNAME"Category",
(case when accountdefinition.ORG_NAME is NULL then 'ALL Accounts' else accountdefinition.ORG_NAME end)"Associated Accounts" FROM categorydefinition
LEFT JOIN categoryaccountmapping ON (categoryaccountmapping.CATEGORYID = categorydefinition.CATEGORYID)
LEFT JOIN accountdefinition ON (categoryaccountmapping.ACCOUNTID = accountdefinition.ORG_ID)
order by 1