MySQL对某个限定查询前几项,例如对年龄查询前三项
SELECT* FROM Stu
order by age desc limit 3
语法:
SELECT x FROM table order by x desc limit 3
SELECT x FROM table WHERE rownum<4 order by x desc
注:desc表示降序【descend v.下降】 的缩写
rownum是自定义变量,表示行号
MySQL对某个限定查询前几项,例如对年龄查询前三项
SELECT* FROM Stu
order by age desc limit 3
语法:
SELECT x FROM table order by x desc limit 3
SELECT x FROM table WHERE rownum<4 order by x desc
注:desc表示降序【descend v.下降】 的缩写
rownum是自定义变量,表示行号