如何获得每个用户表中的最高最高分 [英] how to get top max score in table per user

查看:112
本文介绍了如何获得每个用户表中的最高最高分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请有人告诉我如何在sql server 2008中的表中获得每位用户的最高得分
我正在开发一个用于测验的游戏,其中一个用户可以在一天中多次玩游戏,而我们必须找到他或她在白天的最高分数.
请在SQL表中告诉一个人...

Pls some one tell that how to get top score per user in table in sql server 2008
i am developing a game for quiz in which one user can play game multiple times during the day and we have to find what is his or her max score during the day.
Pls some one tell in sql table...

推荐答案

SQL如下所示.

从xxx
中选择user_name,max(user_score) 按用户名分组;


这将返回每个用户的最高分数.
如果您希望每位用户都想要它,则它看起来如下所示.

从xxx
中选择max(user_score) 其中user_name =''JohnDoe''
按用户名分组;
The SQL would look like the following.

select user_name, max(user_score) from xxx
group by user_name;


That will return every user with their max score.
If you want it per user then it looks like the following.

select max(user_score) from xxx
where user_name=''JohnDoe''
group by user_name;


这篇关于如何获得每个用户表中的最高最高分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆