我有以下代码
SELECT PRESENTERS.PNRFNAME, PRESENTERS.PNRLNAME,
COUNT(EPISODES.PRESENTERID) AS "no. of episodes"
FROM EPISODES
JOIN PRESENTERS
ON EPISODES.PRESENTERID=PRESENTERS.PRESENTERID
GROUP BY PRESENTERS.PNRFNAME, PRESENTERS.PNRLNAME
ORDER BY COUNT(EPISODES.PRESENTERID)
我试着加上
HAVING COUNT(EPISODES.PRESENTERID) > 2
但我得假装我没看过多少集。有没有其他方法可以显示更多集的行?
最佳答案
select top 1 PRESENTERS.PNRFNAME, PRESENTERS.PNRLNAME,COUNT(EPISODES.PRESENTERID) AS "no. of episodes" FROM EPISODES JOIN PRESENTERS ON EPISODES.PRESENTERID=PRESENTERS.PRESENTERID GROUP BY PRESENTERS.PNRFNAME, PRESENTERS.PNRLNAME ORDER BY COUNT(EPISODES.PRESENTERID) desc;
关于mysql - 我想显示最高编号。集数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38889342/