查询MYSQL表字段最大值的方法

来源:互联网 发布:日本电影翻译软件 编辑:程序博客网 时间:2024/05/22 11:33

转载自http://database.51cto.com/art/201011/234851.htm

MYSQL表字段最大值是我们经常需要取得的值,下面就为您介绍查询MYSQL表字段最大值的方法,希望可以让您对MYSQL表字段最大值有更多的了解。

如图、 假如想要取得最大ID的name值(这里只是借ID为例 不用ordery by)

解决办法:select max(id) from db_name                                                      x

将导致

 

正确解法:select * from dbname where id=(select max(id) from dbname)   

0 0
原创粉丝点击