Reputation: 1398
Is it possible to select max of subquery. I tried the following SELECT MAX(SELECT COUNT(lid) AS count FROM Lessons GROUP BY day) , but it obviously failed. Any suggestions?
Upvotes: 1
Views: 347
Reputation: 136
SELECT MAX(myCount) FROM (SELECT COUNT(lid) AS myCount FROM Lessons GROUP BY day) AS sub Query
I believe this is what you are looking for.
Upvotes: 1
Reputation: 204756
Why not just
SELECT COUNT(lid) AS count
FROM Lessons
GROUP BY day
ORDER BY count desc
limit 1
Upvotes: 3