【问题标题】:select according to ranking formula [duplicate]根据排名公式选择[重复]
【发布时间】:2013-05-21 09:42:13
【问题描述】:

我有一个表格,其中填充了用户提交的链接,这些链接已被其他用户投票。该表有一个列votes 和一个列date,格式为2013-05-12 11:52:55。我现在想使用以下公式选择排名最高的链接/行:(取自here

(p - 1) / (t + 2)^1.5
p = votes (points) from users
t = time since submission in hours

显然单独通过投票选择会很容易(使用select by votes desc),但是如何在mysql中实现上述公式?

TIA!

【问题讨论】:

    标签: mysql ranking


    【解决方案1】:
    ORDER BY (votes - 1) / POW(TIME_TO_SEC(TIMEDIFF(NOW(), date))/3600 + 2), 1.5)
    

    【讨论】:

      猜你喜欢
      • 2020-11-07
      • 2014-01-23
      • 2019-01-05
      • 1970-01-01
      • 2017-11-02
      • 2013-12-11
      • 1970-01-01
      • 2012-07-29
      • 1970-01-01
      相关资源
      最近更新 更多