MYSQL - 选择每个玩家每天的最高分数
假设我们有一个如下表,
name | userid | score | datestamp |
-----------------------------------------------------
john | 1 | 44 | 2011-06-10 14:25:55
mary | 2 | 59 | 2011-06-10 09:25:51
john | 1 | 38 | 2011-06-10 21:25:15
elvis | 3 | 19 | 2011-06-10 07:25:18
...
marco | 4 | 100 | 2011-03-10 07:25:18
我想显示每个用户每天的高分。
例如,如果玩家 john 在 2001 年 6 月 10 日打了十轮比赛,我想显示当天的最佳成绩,其他玩家依此类推。
非常感谢您抽出时间。
assuming we have a table like below
name | userid | score | datestamp |
-----------------------------------------------------
john | 1 | 44 | 2011-06-10 14:25:55
mary | 2 | 59 | 2011-06-10 09:25:51
john | 1 | 38 | 2011-06-10 21:25:15
elvis | 3 | 19 | 2011-06-10 07:25:18
...
marco | 4 | 100 | 2011-03-10 07:25:18
i want to display the high-score of each user in each single day.
so for eaxmple if the player john have played ten rounds in the 2001-06-10 i want to display the the best score of that day, and so on for the others players.
thank you very much for the time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
但还要注意,您的表甚至不在第一范式中,因为它缺少唯一的键。此外,修复此问题后,球员姓名将重复,并且必须将其提取到第二范式的单独表中。
标准化设计将有两个表:
But also notice that your table is not even in the first normal form because it lacks an unique key. Also after fixing that, name of players will be repeated, and it will have to be extracted in a separate table for the second normal form.
A normalised design will have two tables:
没有测试过,但是呢?
Not tested, but what about?