开发者

MySQL: select maximum year value from my table?

开发者 https://www.devze.com 2023-01-13 17:43 出处:网络
This is my table: IDValueYear 10Singapore2010 10Malaysia2009 10India2008 Now 开发者_StackOverflowI want to retrieve maximum year record only.

This is my table:

ID           Value       Year
10           Singapore   2010
10           Malaysia    2009
10           India       2008

Now 开发者_StackOverflowI want to retrieve maximum year record only.

Example:

ID             value       year
10             Singapore   2010

How can I write query in MySQL?


select * from tbl order by year desc limit 1

assuming year is unique

0

精彩评论

暂无评论...
验证码 换一张
取 消