假设我有这样一个表:
theme module changed
0 1 1426070691
1 1 1426070300
0 1 1324014321
1 2 1241245585
1 1 1015421251
我需要一个 SQL 查询,它返回同一主题和模块的最大值:
theme module changed
0 1 1426070691
1 1 1426070300
1 2 1241245585
最佳答案
您只需按主题
和模块
对结果进行分组即可:
SELECT theme, module, MAX(changed)
FROM table_name
GROUP BY theme, module
关于mysql - 如何选择最大值并返回多个条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29005307/