MySQL Forums
Forum List  »  Newbie

Re: Joining tables
Posted by: Peter Brawley
Date: May 18, 2020 04:35PM

All-caps is tiresome to read, consider going to lower case default.

You forgot to insert rows into the movieactor table.

A query first collects its data, then assembles the requested result. Build your query similarly, first the From clause ...

from moviaactor ma
join movie m on m.id=ma.movieid and m.name="Big"
join actor a on a.id=ma.actorid
where m.title="Big"

... then prefix the desired Select expressions ...

select 
  group_concat( concat(a.firstname,' ',a.lastname) ) 
  as "Actors in 'Big'"
from movieactor ma
join movie m on m.id=ma.movieid 
join actor a on a.id=ma.actorid
where m.title="Big";

(I've no idea who's in what pop movie, I just added arbitrary ids to get it working.)

Options: ReplyQuote


Subject
Written By
Posted
A A
May 18, 2020 04:10PM
Re: Joining tables
May 18, 2020 04:35PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.