View a list of fields, reporting movies and associates using CROSS JOIN

0

I have three tables, the tb_filme table, the tb_ator and the tb_ator_filme, I need a script that displays the list of all the actors and movies associated with them, follows images to clarify

AndIneedascripttodisplaythemlikethis,usedCROSSJOIN

    
asked by anonymous 25.10.2016 / 21:06

1 answer

0

Are you sure what cross join you need? The cross join does not bind any of the tables. And you have the links. Try this query:

select f.id_filme, f.nome_filme, a.id_ator, a.nome_ator
from tb_filme f join tb_ator_filme af
on (f.id_filme=af.id_filme)
join tb_ator a
on (a.id_ator = af.id_ator)

Ps: I do not have it now with me BD to test but I think it does what it needs

    
28.10.2016 / 11:03