开发者

Calculations in mysql statement for rating

开发者 https://www.devze.com 2023-01-11 00:43 出处:网络
I want开发者_StackOverflow社区 order a selection of items by the rating. There are 2 fields: rateup and ratedown. I use these fields to calculate a number and order the selection on that number. Can t

I want开发者_StackOverflow社区 order a selection of items by the rating. There are 2 fields: rateup and ratedown. I use these fields to calculate a number and order the selection on that number. Can that be done in mysql? I have a querylike this, but this doesn't work:

SELECT * FROM table ORDER BY (((9/rateup+ratedown)*rateup)+1) DESC

How can I make this work or is this impossible?


Select *, (((9/rateup+ratedown)*rateup)+1) As Ord from Table WHERE published = 1 Order By Ord Desc

added Where Clause as requested.

0

精彩评论

暂无评论...
验证码 换一张
取 消