The right query is something like this:
SELECT m.title, COUNT(*)
FROM movies m JOIN
copies c
ON m.mid = c.mid
GROUP BY m.title
HAVING COUNT(*) > 2;
If you don't need the title, then the JOIN
is not even necessary:
SELECT c.mid, COUNT(*)
FROM copies c
GROUP BY c.mid
HAVING COUNT(*) > 2;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.