1

我有一张满是用户的表,使用下面的查询,我可以得到最高分除以分数的结果:

SELECT MAX(points/score) FROM table

但是,我想获取与结果关联的用户;有什么建议么?

4

2 回答 2

3
SELECT * 
  FROM table
 ORDER BY points/score DESC
 LIMIT 1
于 2012-06-26T07:49:04.827 回答
1

只需排序points/score并将结果限制为一个:

SELECT
  *
FROM
  table
ORDER BY
  points/score DESC
LIMIT 1
于 2012-06-26T07:47:11.480 回答