• I was a little confused.

    I know you can only use whatever values are actually passed back (defined) from the CTE, I didn't know that the value remembers which row and table it came from.

    I thought that:

    UPDATE table1_filtered

    SET t_txt = 'New Val'

    I thought that the value passed back was just a value.

    If you did something like:

    SELECT t_id, t_txt

    FROM

    (

    SELECT t1.t_id, t2.t_txt --This is changed to t2

    FROM #table1 t1

    JOIN #table2 t2 ON t1.t_id = t2.t_id

    ) a

    The outside select doesn't actually know the tables and rows that t_id and t_txt actually come from - or does it?

    Thanks,

    Tom