标签: mysql sql count max
我有这个问题:
SELECT tag, filename, timecode, COUNT(tag) AS total FROM dados WHERE dados.tag = 'movie' AND dados.filename = 'movie2.mp4' GROUP BY timecode
这就是结果:
但我只想要第3行,更确切地说是时间码= 2,因为它是具有较高值的最具组成标记。 如何从这些行中获取最高时间码值?
答案 0 :(得分:0)
将ORDER BY与LIMIT
ORDER BY
LIMIT
SELECT tag, filename, timecode, COUNT(tag) AS total FROM dados WHERE dados.tag = 'movie' AND dados.filename = 'movie2.mp4' GROUP BY timecode ORDER BY COUNT(tag) DESC LIMIT 1