• jeffshelix - Wednesday, January 3, 2018 9:10 AM

    ISnt this code joining the tables?

    left JOIN [TSC].[EMS_TVC_PROD_CLASS] C 
    ON #TEMP1.PD_ID = C.[PROD_ID]

    Nope, that is joining to [TSC].[EMS_TVC_PROD_CLASS] and referencing #TEMP1 in the join criteria but you haven't actually joined to #TEMP1 which is why it's complaining.