Wow, I thought that some of the auto-generated SQL from the depths of wordpress were bad... that's before I saw The Query of Despair over at The Daily WTF.