+"CASE WHEN am.StandardAccountCode='0000' THEN am.StandardAccountCode ELSE sa.Code END StdCode,"
+"sa.Name StdName,sa.ParentCode StdParentCode "
+"FROM (SELECT * FROM EnterpriseAccount where parentcode=#{parentCode} and Enterpriseaccountsetid=#{accountSetId}) ea "
+"LEFT JOIN (SELECT * FROM AccountMapping WHERE OrganizationID=#{orgId} AND IndustryID=#{industryId} AND EnterpriseAccountSetID=#{accountSetId}) am ON ea.Code=am.EnterpriseAccountCode "
+"LEFT JOIN (SELECT * FROM StandardAccount WHERE IndustryID=#{industryId}) sa ON am.StandardAccountCode=sa.Code "
+"CASE WHEN am.STANDARD_ACCOUNT_CODE='0000' THEN am.STANDARD_ACCOUNT_CODE ELSE sa.Code END StdCode,"
+"sa.Name StdName,sa.PARENT_CODE StdParentCode "
+"FROM (SELECT * FROM ENTERPRISE_ACCOUNT where PARENT_CODE=#{parentCode} and ENTERPRISE_ACCOUNT_SET_ID=#{accountSetId}) ea "
+"LEFT JOIN (SELECT * FROM ACCOUNT_MAPPING WHERE ORGANIZATION_ID=#{orgId} AND INDUSTRY_ID=#{industryId} AND ENTERPRISE_ACCOUNT_SET_ID=#{accountSetId}) am ON ea.Code=am.ENTERPRISE_ACCOUNT_CODE "
+"LEFT JOIN (SELECT * FROM StandardAccount WHERE IndustryID=#{industryId}) sa ON am.STANDARD_ACCOUNT_CODE=sa.Code "