Question2Answer query failed:

(SELECT '0' AS selectkey, qa_users.userid, passsalt, HEX(passcheck) AS passcheck, email, level, emailcode, handle, UNIX_TIMESTAMP(created) AS created, sessioncode, sessionsource, flags, UNIX_TIMESTAMP(loggedin) AS loggedin, INET_NTOA(loginip) AS loginip, UNIX_TIMESTAMP(written) AS written, INET_NTOA(writeip) AS writeip, avatarblobid, avatarwidth, avatarheight, points, NULL AS title, NULL AS content, NULL AS fieldid, NULL AS position, NULL AS qposts, NULL AS aposts, NULL AS cposts, NULL AS aselects, NULL AS aselecteds, NULL AS qupvotes, NULL AS qdownvotes, NULL AS aupvotes, NULL AS adownvotes, NULL AS qvoteds, NULL AS avoteds, NULL AS upvoteds, NULL AS downvoteds, NULL AS bonus, NULL AS rank, NULL AS postid, NULL AS categoryid, NULL AS type, NULL AS basetype, NULL AS hidden, NULL AS acount, NULL AS selchildid, NULL AS closedbyid, NULL AS upvotes, NULL AS downvotes, NULL AS netvotes, NULL AS views, NULL AS hotness, NULL AS flagcount, NULL AS tags, NULL AS categoryname, NULL AS categorybackpath, NULL AS cookieid, NULL AS createip, NULL AS obasetype, NULL AS ohidden, NULL AS opostid, NULL AS ouserid, NULL AS ocookieid, NULL AS oip, NULL AS otime, NULL AS oflagcount, NULL AS oupdatetype, NULL AS pageid, NULL AS permit, NULL AS nav, NULL AS heading, NULL AS widgetid, NULL AS place FROM qa_users LEFT JOIN qa_userpoints ON qa_userpoints.userid=qa_users.userid WHERE qa_users.handle='thagee.vedartham') UNION ALL (SELECT '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, title, content, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_userprofile WHERE userid=(SELECT userid FROM qa_users WHERE handle='thagee.vedartham' LIMIT 1)) UNION ALL (SELECT '2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, title, content, fieldid, position, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_userfields) UNION ALL (SELECT '3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, points, NULL, NULL, NULL, NULL, qposts, aposts, cposts, aselects, aselecteds, qupvotes, qdownvotes, aupvotes, adownvotes, qvoteds, avoteds, upvoteds, downvoteds, bonus, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_userpoints WHERE userid=(SELECT userid FROM qa_users WHERE handle='thagee.vedartham' LIMIT 1)) UNION ALL (SELECT '4', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1+COUNT(*), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_userpoints WHERE points>COALESCE((SELECT points FROM qa_userpoints WHERE userid=(SELECT userid FROM qa_users WHERE handle='thagee.vedartham' LIMIT 1)), 0)) UNION ALL (SELECT '5', qa_posts.userid, NULL, NULL, qa_users.email, qa_users.level, NULL, qa_users.handle, UNIX_TIMESTAMP(qa_posts.created), NULL, NULL, qa_users.flags, NULL, NULL, NULL, NULL, qa_users.avatarblobid, qa_users.avatarwidth, qa_users.avatarheight, qa_userpoints.points, qa_posts.title, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, qa_posts.postid, qa_posts.categoryid, qa_posts.type, LEFT(qa_posts.type, 1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.selchildid, qa_posts.closedbyid, qa_posts.upvotes, qa_posts.downvotes, qa_posts.netvotes, qa_posts.views, qa_posts.hotness, qa_posts.flagcount, qa_posts.tags, qa_categories.title, qa_categories.backpath, qa_posts.cookieid, INET_NTOA(qa_posts.createip), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_posts LEFT JOIN qa_categories ON qa_categories.categoryid=qa_posts.categoryid LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid WHERE qa_posts.userid=(SELECT userid FROM qa_users WHERE handle='thagee.vedartham' LIMIT 1) AND type='Q' ORDER BY qa_posts.created DESC LIMIT 50) UNION ALL (SELECT '6', qa_posts.userid, NULL, NULL, qa_users.email, qa_users.level, NULL, qa_users.handle, UNIX_TIMESTAMP(qa_posts.created), NULL, NULL, qa_users.flags, NULL, NULL, NULL, NULL, qa_users.avatarblobid, qa_users.avatarwidth, qa_users.avatarheight, qa_userpoints.points, qa_posts.title, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, qa_posts.postid, qa_posts.categoryid, qa_posts.type, LEFT(qa_posts.type, 1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.selchildid, qa_posts.closedbyid, qa_posts.upvotes, qa_posts.downvotes, qa_posts.netvotes, qa_posts.views, qa_posts.hotness, qa_posts.flagcount, qa_posts.tags, qa_categories.title, qa_categories.backpath, qa_posts.cookieid, INET_NTOA(qa_posts.createip), LEFT(aposts.type, 1), INSTR(aposts.type, '_HIDDEN')>0, aposts.postid, aposts.userid, aposts.cookieid, INET_NTOA(aposts.createip), UNIX_TIMESTAMP(aposts.created), aposts.flagcount, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_posts LEFT JOIN qa_categories ON qa_categories.categoryid=qa_posts.categoryid LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid JOIN qa_posts AS aposts ON qa_posts.postid=aposts.parentid JOIN (SELECT postid FROM qa_posts WHERE userid=(SELECT userid FROM qa_users WHERE handle='thagee.vedartham' LIMIT 1) AND type='A' ORDER BY created DESC LIMIT 50) y ON aposts.postid=y.postid WHERE qa_posts.type='Q') UNION ALL (SELECT '7', qa_posts.userid, NULL, NULL, qa_users.email, qa_users.level, NULL, qa_users.handle, UNIX_TIMESTAMP(qa_posts.created), NULL, NULL, qa_users.flags, NULL, NULL, NULL, NULL, qa_users.avatarblobid, qa_users.avatarwidth, qa_users.avatarheight, qa_userpoints.points, qa_posts.title, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, qa_posts.postid, qa_posts.categoryid, qa_posts.type, LEFT(qa_posts.type, 1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.selchildid, qa_posts.closedbyid, qa_posts.upvotes, qa_posts.downvotes, qa_posts.netvotes, qa_posts.views, qa_posts.hotness, qa_posts.flagcount, qa_posts.tags, qa_categories.title, qa_categories.backpath, qa_posts.cookieid, INET_NTOA(qa_posts.createip), LEFT(cposts.type, 1), INSTR(cposts.type, '_HIDDEN')>0, cposts.postid, cposts.userid, cposts.cookieid, INET_NTOA(cposts.createip), UNIX_TIMESTAMP(cposts.created), cposts.flagcount, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_posts LEFT JOIN qa_categories ON qa_categories.categoryid=qa_posts.categoryid LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid JOIN qa_posts AS parentposts ON qa_posts.postid=(CASE parentposts.type WHEN 'A' THEN parentposts.parentid ELSE parentposts.postid END) JOIN qa_posts AS cposts ON parentposts.postid=cposts.parentid JOIN (SELECT postid FROM qa_posts WHERE userid=(SELECT userid FROM qa_users WHERE handle='thagee.vedartham' LIMIT 1) AND type='C' ORDER BY created DESC LIMIT 50) y ON cposts.postid=y.postid WHERE qa_posts.type='Q' AND parentposts.type IN ('Q', 'A')) UNION ALL (SELECT '8', qa_posts.userid, NULL, NULL, qa_users.email, qa_users.level, NULL, qa_users.handle, UNIX_TIMESTAMP(qa_posts.created), NULL, NULL, qa_users.flags, NULL, NULL, NULL, NULL, qa_users.avatarblobid, qa_users.avatarwidth, qa_users.avatarheight, qa_userpoints.points, qa_posts.title, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, qa_posts.postid, qa_posts.categoryid, qa_posts.type, LEFT(qa_posts.type, 1), INSTR(qa_posts.type, '_HIDDEN')>0, qa_posts.acount, qa_posts.selchildid, qa_posts.closedbyid, qa_posts.upvotes, qa_posts.downvotes, qa_posts.netvotes, qa_posts.views, qa_posts.hotness, qa_posts.flagcount, qa_posts.tags, qa_categories.title, qa_categories.backpath, qa_posts.cookieid, INET_NTOA(qa_posts.createip), LEFT(editposts.type, 1), INSTR(editposts.type, '_HIDDEN')>0, editposts.postid, editposts.lastuserid, editposts.cookieid, INET_NTOA(editposts.lastip), UNIX_TIMESTAMP(editposts.updated), editposts.flagcount, editposts.updatetype, NULL, NULL, NULL, NULL, NULL, NULL FROM qa_posts LEFT JOIN qa_categories ON qa_categories.categoryid=qa_posts.categoryid LEFT JOIN qa_users ON qa_posts.userid=qa_users.userid LEFT JOIN qa_userpoints ON qa_posts.userid=qa_userpoints.userid JOIN qa_posts AS parentposts ON qa_posts.postid=IF(LEFT(parentposts.type, 1)='Q', parentposts.postid, parentposts.parentid) JOIN qa_posts AS editposts ON parentposts.postid=IF(LEFT(editposts.type, 1)='Q', editposts.postid, editposts.parentid) JOIN (SELECT postid FROM qa_posts WHERE lastuserid=(SELECT userid FROM qa_users WHERE handle='thagee.vedartham' LIMIT 1) AND type IN ('Q', 'A', 'C') ORDER BY updated DESC LIMIT 50) y ON editposts.postid=y.postid WHERE parentposts.type IN ('Q', 'A', 'C') AND qa_posts.type IN ('Q', 'A', 'C')) UNION ALL (SELECT 'pending_navpages', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, title, NULL, NULL, position, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tags, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, pageid, permit+0, nav, heading, NULL, NULL FROM qa_pages WHERE nav IN ('B','M','O','F') ORDER BY position) UNION ALL (SELECT 'pending_widgets', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, title, NULL, NULL, position, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tags, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, widgetid, place FROM qa_widgets ORDER BY position)

Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank, NULL AS postid, NULL AS categoryid, NULL AS type, NULL AS basetype, NULL A' at line 1