i have 3 tables:
authors
idname
1 albert
2bobby
3 carl
4 dan
authors_musicals
rowidauthor_idmusical_id
1 1 1
2 2 1
3 1 2
4 1 3
musicals
id title year
1 brigadoon 1947
2my fair lady1956
3 oklahoma! 1943
4 camelot 1960
i need titles belonging albert
(his id
(1) authors corresponds musical_id
(1, 2, 3) in authors_musicals each correspond title
(brigadoon, fair lady, oklahoma!) in musicals). thought following work:
select title musicals id=(select musical_id authors_musicals author_id=(select id authors name="albert"));
this gives me first listing. how can 3 , since these tables linked, there simpler way of getting want?
join
tables:
select musicals.title musicals join authors_musicals on (musicals.id = authors_musicals.musical_id) join authors on (authors.id = authors_musicals.author_id) authors.name = "albert"