Probably, you need to clarify which TID value you are trying to access.
WHERE TID = (CASE WHEN ...
Doesn't specify, but the rest of the code:
C.TID IS NULL ... WHEN R.TID IS NULL ...
Shows two values with the same name in different tables.
I'm just guessing you want
WHERE U.TID = (CASE WHEN ...