sqlt-sqlouter-join

Full outer join not working, got a multi-part identifier could not be bound error


I am doing a full outer join of two tables, but received the multi-part identifier could not be bound error. I couldn't figure out why as I have checked everything else.

SELECT      A.INTEGRATION_ID,
            A.CURR_STG_NAME,
            B.CURR_STG_NAME
    
FROM        OPTY0430 AS A
FULL OUTER JOIN OPTY0507 AS B
ON OPTY0430.INTEGRATION_ID=OPTY0507.INTEGRATION_ID

I can not use inner join or cross join. I have to use full outer join to achieve what I am trying to do


Solution

  • Since you declared alias A and B for tables you need to use those in join your condition instead of actual table names.

    SELECT      A.INTEGRATION_ID,
                A.CURR_STG_NAME,
                B.CURR_STG_NAME
        
    FROM        OPTY0430 AS A
    FULL OUTER JOIN OPTY0507 AS B
    ON A.INTEGRATION_ID=B.INTEGRATION_ID