V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
baby
V2EX  ›  分享发现

新浪开放平台QA系统报错,SQL奇长。

  •  
  •   baby · 2013-04-12 09:53:22 +08:00 · 2678 次点击
    这是一个创建于 4242 天前的主题,其中的信息可能已经有所发展或是发生改变。
    查询时候报错:

    Question2Answer query failed:

    SELECT qa_posts.postid, qa_posts.categoryid, qa_posts.type, LEFT(qa_posts.type, 1) AS basetype, INSTR(qa_posts.type, '_HIDDEN')>0 AS hidden, 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.title, qa_posts.tags, UNIX_TIMESTAMP(qa_posts.created) AS created, qa_categories.title AS categoryname, qa_categories.backpath AS categorybackpath, qa_posts.userid, qa_posts.cookieid, INET_NTOA(qa_posts.createip) AS createip, qa_userpoints.points, qa_users.flags, qa_users.level, qa_users.email AS email, qa_users.handle AS handle, qa_users.avatarblobid, qa_users.avatarwidth, qa_users.avatarheight, score, matchparts 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 (SELECT questionid, SUM(score)+2*(LOG(10000)*(qa_posts.hotness-(SELECT MIN(hotness) FROM qa_posts WHERE type='Q'))/((SELECT MAX(hotness) FROM qa_posts WHERE type='Q')-(SELECT MIN(hotness) FROM qa_posts WHERE type='Q')))+LOG(questionid)/1000000 AS score, GROUP_CONCAT(CONCAT_WS(':', matchposttype, matchpostid, ROUND(score,3))) AS matchparts FROM ((SELECT postid AS questionid, LOG(10000/titlecount) AS score, 'Q' AS matchposttype, postid AS matchpostid FROM qa_titlewords JOIN qa_words ON qa_titlewords.wordid=qa_words.wordid WHERE word IN ('接','入','者','在','开','发','数','据','营','销','电','商','应','用','时',',','请','选','择','创','建','专','业','版','应','用') AND titlecount<10000) UNION ALL (SELECT questionid, (1-1/(1+count))*LOG(10000/contentcount)*(CASE qa_contentwords.type WHEN 'Q' THEN 1.0 WHEN 'A' THEN 0.5 ELSE 0.25 END) AS score, qa_contentwords.type AS matchposttype, qa_contentwords.postid AS matchpostid FROM qa_contentwords JOIN qa_words ON qa_contentwords.wordid=qa_words.wordid WHERE word IN ('接','入','者','在','开','发','数','据','营','销','电','商','应','用','时',',','请','选','择','创','建','专','业','版','应','用') AND contentcount<10000)) x LEFT JOIN qa_posts ON qa_posts.postid=questionid GROUP BY questionid ORDER BY score DESC LIMIT 0,50) y ON qa_posts.postid=y.questionid
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3593 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 18ms · UTC 10:23 · PVG 18:23 · LAX 02:23 · JFK 05:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.