我想从表格中获得最大访问人数,
但出现错误Table 'test.VisitCount' doesn't exist
我相信别名VisitCount
不起作用。
如何解决?
这是我的代码:
SELECT CharName, Movie, Counts
FROM
(
SELECT TT.Character_Name AS CharName, TT.Movie AS Movie, COUNT(*) AS Counts
FROM TimeTable TT
GROUP BY TT.Character_Name, TT.Movie
) AS VisitCount
WHERE Counts = (SELECT MAX(Counts) FROM VisitCount);