'Full outer join a table to another table that's being left joined to the main table

So i've got hte below code that works for the most part but when I'm trying to bring in the last table i cant get the expected results.

        SELECT 
            
            CASE 
                WHEN CCO.Account_Manager__c IS NULL THEN Opp.OwnerId ELSE CCO.Account_Manager__c
            END AS AccountManager,
        CCO.Account_Associate__c as ClientOfficeAccountAssociate,
        Opp.OwnerId as AccountOwnerId,
        CCO.Account_Manager__c as ClientOfficeAM,
        ACC.Name as AccountName,
        
        OPP.Forum_Monthly_Recurring_Revenue_MRR__c,

     PAYG.Revenue 
    
    
    LEFT JOIN `round-cacao-234512.salesforce.Opportunity` as OPP 
    ON OPP.Id = Split.OpportunityId AND OPP.OwnerId = Split.SplitOwnerId
    
    LEFT JOIN `round-cacao-234512.salesforce.Account` as ACC 
    on ACC.Id = OPP.AccountId
    
    LEFT JOIN `round-cacao-234512.salesforce.User` as USER 
    ON USER.Id = OPP.OwnerId
    
    LEFT JOIN `round-cacao-234512.salesforce_df.Company_Client_Office__c` as CCO 
    ON CCO.Opportunity__c = OPP.Id
    
    LEFT JOIN `round-cacao-234512.salesforce.Client_Office_Intranet__c` as COI 
    ON COI.Id = CCO.Client_Office_Intranet__c
    
    LEFT JOIN `round-cacao-234512.salesforce.RecordType` as RT 
    ON RT.Id = OPP.RecordTypeId

LEFT JOIN `commercial-analysis.materialised.2022AMDashForumRRQuotas` as Quota
on Quota.AccountID = CCO.Account_Manager__c OR Quota.AccountID = Opp.OwnerId


LEFT JOIN `commercial-analysis.2022_AM_Territory.FPAYG_Quotas` as PAYGQuota
on PAYGQuota.ClientOffice = COI.Name

Full Outer JOIN `round-cacao-234512.materialised.2022AMDashPAYGRevenue` PAYGRev
on PAYGRev.ClientOffice = COI.Name

So my last table round-cacao-234512.materialised.2022AMDashPAYGRevenue will be joined on clientoffice but will also have client offices that don't appear in COI, so I want those to come in with nulls on all the values that don't match up.

Hope that makes sense



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source