Home  >  Article  >  Backend Development  >  mysql select 的有关问题

mysql select 的有关问题

WBOY
WBOYOriginal
2016-06-13 12:57:42764browse

mysql select 的问题


mysql> select * from u01;
+----+-----+------+
| id | num | data |
+----+-----+------+
| 1 | 12 | 13 |
| 2 | 13 | 14 |
| 3 | 15 | 14 |
| 4 | 16 | 14 |
| 5 | 17 | 13 |
+----+-----+------+
5 rows in set (0.00 sec)



如何查到 data 最大 且同时 num也是最大的那个值?呢

谢谢
------解决方案--------------------
select * from u01 order by data desc, num desc limit 1

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn