如何在php中尽可能高效地对数据进行计数和排名
我对编程并不陌生,但对 MySQL 和 PHP 很陌生。 我想知道执行以下操作最有效的方法是什么。 我不需要实际的代码,只需要步骤。
我有一个用户评论列表,简单地说:
USER REVIEW
Bob nice
John good
Fred bad
Bob poor
Bob the best
Fred medicre
Bob shiny
我希望能够创建一个发表最多评论的评论者列表,即
USER REVIEWS
Bob 4
Fred 2
John 1
什么是解决此问题的最佳方法,以最有效的方式
欢呼!
I'm not new to programming, but i'm new to MySQL and PHP. I'm wondering what the most efficient way of doing the following. I dont need the actual code, but just the steps.
I have a list of user reviews, lets say simply:
USER REVIEW
Bob nice
John good
Fred bad
Bob poor
Bob the best
Fred medicre
Bob shiny
I want to be able to create a list of the reviewers that have made the most reviews, ie
USER REVIEWS
Bob 4
Fred 2
John 1
WHat's the best way of going about this, in the most efficient way
cheers!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您的查询:
As your query:
有时,程序员用代码来解释自己会更容易:
所以,基本上,9/10 次,最好让 SQL 来做排序之类的事情,因为它在做这样的事情上效率更高。
Sometimes it's just easier for programmers to explain themselves with code:
So, basically, 9/10 times, it's best to let SQL do the sorting and stuff because it's just way more efficient at stuff like that.