SQLServer查询值最大行的数据

查询最大值:select MAX(score) from t_student;

查询最大值行数据: select TOP 1 * from t_student order by score desc;

(mysql写法: select * from t_student order by score desc limit 1)

如果存在多行都是最大值,可以这么写:

select * from t_student where score = (select MAX(score) from t_student)

猜你喜欢

转载自blog.csdn.net/kaiyuantao/article/details/116453550