如何在SQL和PHP中执行此操作? [英] How to do this in SQL and php?

查看:77
本文介绍了如何在SQL和PHP中执行此操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello people,



i我坚持这个,请帮帮我,怎么做。



i有一个sql表,带字段,



名字,用户名,得分,



表包含,这样的数据,



user1 username1 5

user2 username2 10

user1 username1 2

user2 username2 1



现在,我需要一个php和sql脚本来显示一个已排序的表,用户应该只出现一次高分。



喜欢,



user2 username2 10

user1用户名5



我的帮助非常需要,谢谢!

Hello people,

i am stuck with this, please help me, how to do this.

i have a sql table, with fields,

name, username, score,

the table contains, data like this,

user1 username1 5
user2 username2 10
user1 username1 2
user2 username2 1

Now, i need a php and sql script to show a sorted table,with a user should appear only once with their highscores.

Like,

user2 username2 10
user1 username 5

Your help is verymuch needed, thank you!

推荐答案

在sql中非常简单的sql查询:



in sql its very simple sql query:

select Name, Username, max(score) from tbl group by Name, Username


从这个非常全面的教程学习:使用PHP访问SQL Server数据库 [ ^ ]
Learn to do it from this very comprehensive tutorial: Accessing SQL Server Databases with PHP[^]


这篇关于如何在SQL和PHP中执行此操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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