knrt.net
相关文档
当前位置:首页 >> mysql 获取最小值 >>

mysql 获取最小值

select max(字段名) from tableName limit 0,1 最大 select min(字段名) from tableName limit 0,1 最小 select * from tableName order by 字段名 DESC limit 0,1 最大 select * from tableName order by 字段名 ASC limit 0,1 最小

SELECT * from PTest WHERE PCode=(SELECT min(PCode) FROM PTest WHERE PCount=(SELECT min(PCount) from PTest))

使用聚合函数min()求最小值,对应max()求最大值。 SELECT roomID FROM room WHERE guestNumber = (SELECT MIN(guestNumber) FROM room)

如下: mysql> mysql>select max(group) as maxid from dm_user; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql >sele...

min()函数 比如有如下数据:表名:UserInfo agenamegender 13aaa男 16bbb女 12ccc妖 SQL:select * from UserInfo where age=(select min(age) from UserInfo) 结果: agenamegender 12ccc妖 查询出最小的年龄,然后查询该人的详细信息。 拙见。

select max(字段) from table where....

SELECT 语句用于从数据库中选取数据。 语句1:SELECT * FROM table_name 解说:意思就是读取整个表table_name里面的数据显示出来 语句1:SELECT * FROM table_name Where x = 1 解说:意思就是读取表table_name里面键名为:x 值为:1的 数据显示出来...

最大值:select max(num) from table 第二大值:select max(num) from table where num not in(select max(num) from table) 第三大值:select max(num) from table where num not in(select max(num) from table where num not in(select max(n...

select max(字段名) from tableName limit 0,1 最大select min(字段名) from tableName limit 0,1 最小select * from tableName order by 字段名 DESC limit 0,1 最大select * from tableName order by 字段名 ASC limit 0,1 最小

网站首页 | 网站地图
All rights reserved Powered by www.knrt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com