This is just a minor note, but it took me a really long time to debug, so I thought I would put it up here. Apparently, IF statements and ELSE statements are not allowed in the general SQL processing flow of MySQL scripts. They are only allowed in functions and stored procedures. Looking back at my research, that makes sense - you can only ever find documentation on the IF statement in the context of stored procedures and functions; however, the document is really really poor at announcing that (I guess it just assumes you are reading the entire MySQL manual from start to end or something).
I never found a great work-around to this problem and resorted to breaking my logic up into two different CFQuery tags. It feels hacky, but it gets the job done.