Thanks, that's very helpful! I guess my question was really "how do I avoid unexpected results like these" and it seems as though "don't reassign to variables that already exists" is the answer. I would appreciate a more technical explanation if anyone is up for giving it, but that's the basic information I needed. That coalesce function looks really useful, by the way, thank you for mentioning it.
... View more