Problem, I was doing join statement and getting this error Msg 4104, Level 16, State 1, Line 69
The multi-part identifier "a.X" could not be bound."
Cause:
I was mixing implicit joins with explicit joins. That is allowed, but you need to be aware of how to do that properly.
The thing is, explicit joins (the ones that are implemented using the JOIN keyword) take precedence over implicit ones (the 'comma' joins, where the join condition is specified in the WHERE clause).