-1

I have a table populated with user-submitted links which have been voted on by other users. The table has a column votes as well as a column date in the format 2013-05-12 11:52:55. I now want to select the highest ranking links/rows by using the following formula: (taken from here)

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

Obviously selecting by votes alone would be easy (with select by votes desc), but how do I implement the above formula in mysql?

TIA!

Community
  • 1
  • 1
Phil
  • 1,719
  • 6
  • 21
  • 36

1 Answers1

-1
ORDER BY (votes - 1) / POW(TIME_TO_SEC(TIMEDIFF(NOW(), date))/3600 + 2), 1.5)
Aioros
  • 4,373
  • 1
  • 18
  • 21