例如数据表中有一列为工资,查询工资最高的,可以这么写语句:
sql server 数据库下的:
select top 1 工资 from table1 order by 工资 desc;
或者:select top(1) * from table1 order by 工资 desc;
其他的类似
select top 1 with ties id,工资 from table1 order by 工资 asc
最少
MySql数据库下使用:
select * from stutable order by age asc limit 0,1
转载请注明:有客帮 » SQL查询某字段最小值:(不使用min() max())