I have a three tables about movies. First one is movie
, second one is actor
and last one is movie_actor_mapping
. I wrote an query that select data from table movie and group actors for each movie. And my query select all actors from actor
table but I have to select only first 4 actors. How can I modify my select to do it?
SELECT title, year, poster, rating, group_concat(a.name separator ', ') as actors
FROM movie m
INNER JOIN movie_actor_mapping ma ON m.movie_id = ma.movie_id
INNER JOIN actor a ON a.actor_id = ma.actor_id
WHERE m.rating IS NOT NULL
GROUP BY m.movie_id
ORDER BY m.rating DESC;