Congregational support for organizations (detail)
SELECT j.id, if( length(regOrgs.name) > 0, CONCAT_WS('', regOrgs.name, ' (', regOrgs.city, ')'), CONCAT_WS('', unregOrgs.name, ' (', unregOrgs.city, ')') ) as Org_name, if( length(regCongs.name) > 0, concat_ws('', regCongs.name,' (', regCongs.city, ')'), concat_ws('', unregCongs.name, ' (', unregCongs.city,')' ) ) as Congregation_name, volunteerSupport as Vol_support, financialSupport as Fin_support, UseOfSpace as Use_of_space, GoodsOrServices as Goods_or_services, VolunteerHours as Volunteer_hours, VolunteerFrequency as Volunteer_frequency, FinancialSupportAmount as Financial_support_amount, FinancialSupportFrequency as Frequency_of_financial_support, GoodsOrServicesValue as Goods_or_services_value, GoodsOrServicesFrequency as Goods_or_services_frequency, UseOfSpaceFootage as Footage_of_space, UseOfSpaceEstimatedValuePerYear as Space_value, j.Notes, YearOrPeriodCovered as Year_or_period_covered FROM platform.congregationOrganizationJoin j LEFT JOIN nccs.nteedocAllEins regOrgs ON j.orgEin > ' ' and j.orgEin = regOrgs.ein LEFT JOIN nccs.nteedocNoEin unregOrgs ON j.orgId > 0 and j.orgId = unregOrgs.id LEFT JOIN nccs.nteedocAllEins regCongs ON j.congregationEin > ' ' and j.congregationEin = regCongs.ein LEFT JOIN nccs.nteedocNoEin unregCongs ON j.congregationId > 0 and j.congregationId = unregCongs.id where j.platform = 'fips='12009''