• I have an example almost identical to this in my Common TSQL Mistakes session I have given about 75 times now. It represents the WORST king of data processing error - the WRONG OUTPUT/EFFECT with NO WARNING!! The solution (and general best practice in any case) is to ALWAYS use aliases for EVERYTHING. If you do, then your code will BREAK when you try to reference t2.mycolumn when mycolumn doesn't exist on the inner table. See Chris' example...

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service