如何在 MySQL 中的表中获取最高字段值?
问题描述:
如果表people"包含name"(varchar)和birthdate"(日期)列,如何找到最老/最年轻的好友?
If a table "people" contains "name" (varchar) and "birthdate" (date) columns, how to find the oldest/youngest buddy?
答
SELECT * FROM buddies
WHERE birthdate = (
SELECT MAX(birthdate) FROM buddies
)
LIMIT 1;