Home > Backend Development > PHP Tutorial > mysql select 的有关问题

mysql select 的有关问题

WBOY
Release: 2016-06-13 12:57:42
Original
867 people have browsed it

mysql select 的问题

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


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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template