我有表测试,其中列为 id 、 month 、 year 。我需要在一个查询中获取最大月份和最大年份的 ID。
例如
id month year
1 10 2012
2 9 2013
我的结果应该是 id 2。
首先根据我需要获取 ID 的最大月份检查年份
我在 MySQL 中给出这样的查询
select id from book where MAX(month) and MAX(year);
它产生错误
最佳答案
关于mysql - 与两个最大列进行比较得到一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17503080/