SQL Join through Mappings Table -
i may have made datascheme more complicated need current data scheem , im trying got accomplish.
actor id|name |website |... 1 |james |www.james.com |... 2 |ben |www.ben.com |... movie id|name |poster|runtime... 1 |titanic |/a.jpg|98| 2 |terminator|/b.jpg|77| 3 |mib |/c.jpg|89| character id|name 1 |tony 2 |bilbo 3 |gandalf actormoviecharactermapping id|movie_id|actor_id|character_id 1 | 3 |5 |3 2 | 2 |5 |2 3 | 3 |2 |6 my goal of actors character name given movie in fewest number of sql queries possible. can of actors in movie or characters in movie dont know how retrieve actors character name movie. appreciated possible ways format these tables better.
just joins on mapping table:
select a.name actor_name, c.name character_nane actormoviecharactermapping m join actor on m.actor_id = a.id join movie mo on m.monie_id = mo.id join character c on m.character_id = c.id mo.id = 1
Comments
Post a Comment