Last active
July 4, 2016 10:39
-
-
Save ChiChou/8862382 to your computer and use it in GitHub Desktop.
Hacker News 排名算法的MYSQL函数实现
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- (p - 1) / (t + 2)^1.5 | |
CREATE FUNCTION SP_POINTS(P SMALLINT(5), CREATED TIMESTAMP) | |
RETURNS TINYINT(3) | |
RETURN (P - 1) / POW(TIMESTAMPDIFF(HOUR, CREATED, NOW()) + 2, 1.5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment