Hi All,
I am trying do create simple online movie DB for myself and my friends to use, but first of course I have to design properly my DB. As I am not really good with SQL I have problems straight at the beginning ;-(. The error I am having is:
"The SWL statement could not be executed because it contains ambiguous outer join. To force one of the joins to be performed first, create a separate query that performs the first join and then include that query in your SQL statement".
Here w w w. kamyki. com/access/relations.jpg (please remove the spaces) you can see really simple relations between tables (really simple and I still can’t do it).
So I have table with movies (tbl_movies), table with genre (tbl_genre) and table in between which connects both of them, where I can store id’s of movies with id’s of genre they belong to.
1,20
1,20
So you can see here that movie with id=1 belongs to genre with id=1 and 20 (later on with the ASP server script I will work out what genre which ID is (I think I can’s do it via SQL).
So the query:
SELECT tbl_movies.movie_title, tbl_movies.movie_title_org, tbl_movies.movie_year, tbl_movies.movie_imdb, tbl_movieGenreCompact.genre_id
FROM (tbl_movies INNER JOIN tbl_movieGenreCompact ON tbl_movies.movie_id = tbl_movieGenreCompact.movie_id) INNER JOIN (tbl_genre INNER JOIN tbl_movieGenre ON tbl_genre.genre_id = tbl_movieGenre.genre_id) ON tbl_movies.movie_id = tbl_movieGenre.movie_id;
Generates me the table with movies and genres, but if one movie doesn’t have the genre set yet it won’t be shown. I know I have to separate now that query into two smaller ones to generate all movies and then genres of the ones that have something in the tbl_movieGenreCompact table, but I don’t know how.
Please help…. I know it’s not that difficult as few years ago I am sure I would be able to do this but now I really can’t. I mean I hope all here make sense.
Thanks for all help in advance.
Stone28
I am trying do create simple online movie DB for myself and my friends to use, but first of course I have to design properly my DB. As I am not really good with SQL I have problems straight at the beginning ;-(. The error I am having is:
"The SWL statement could not be executed because it contains ambiguous outer join. To force one of the joins to be performed first, create a separate query that performs the first join and then include that query in your SQL statement".
Here w w w. kamyki. com/access/relations.jpg (please remove the spaces) you can see really simple relations between tables (really simple and I still can’t do it).
So I have table with movies (tbl_movies), table with genre (tbl_genre) and table in between which connects both of them, where I can store id’s of movies with id’s of genre they belong to.
tbl_movieGenreCompact
movie_id
genre_id
1
2
So you can see here that movie with id=1 belongs to genre with id=1 and 20 (later on with the ASP server script I will work out what genre which ID is (I think I can’s do it via SQL).
So the query:
SELECT tbl_movies.movie_title, tbl_movies.movie_title_org, tbl_movies.movie_year, tbl_movies.movie_imdb, tbl_movieGenreCompact.genre_id
FROM (tbl_movies INNER JOIN tbl_movieGenreCompact ON tbl_movies.movie_id = tbl_movieGenreCompact.movie_id) INNER JOIN (tbl_genre INNER JOIN tbl_movieGenre ON tbl_genre.genre_id = tbl_movieGenre.genre_id) ON tbl_movies.movie_id = tbl_movieGenre.movie_id;
Generates me the table with movies and genres, but if one movie doesn’t have the genre set yet it won’t be shown. I know I have to separate now that query into two smaller ones to generate all movies and then genres of the ones that have something in the tbl_movieGenreCompact table, but I don’t know how.
Please help…. I know it’s not that difficult as few years ago I am sure I would be able to do this but now I really can’t. I mean I hope all here make sense.
Thanks for all help in advance.
Stone28