So i have two databases, one about movies, one about actors. I need a new database which includes the amount of movies in which each actor has partecipated.
SELECT Count(title) as MovieTotal
FROM movie
JOIN actors
ON film.actorsID = actors.ID
GROUP BY actors.id
This almost works, but I want the actors first and second name to be shown next to the count.. any tips?
CodePudding user response:
Add the columns you want to the SELECT and use those for your GROUP BY.
SELECT actors.firstName, actors.secondName, Count(title) as MovieTotal
FROM movie
JOIN actors
ON film.actorsID = actors.ID
GROUP BY actors.firstName, actors.secondName