(select M.MName 'Movie', S.SName 'Staff Name' from movie as M
left join screen_movie as sc
left join booking as b
left join staff as S
on M.MovieID = screen_movie.MovieID and sc.screen_Movie_ID = b.screen_Movie_ID and b.SID = S.SID)
union
(select M.MName 'Movie', S.SName 'Staff Name' from movie as M
right join screen_movie as sc
right join booking as b
right join staff as S
on M.MovieID = screen_movie.MovieID and sc.screen_Movie_ID = b.screen_Movie_ID and b.SID = S.SID);
答案 0 :(得分:0)
尝试移动每个表的on子句,并在每个选择项周围删除()
select M.MName 'Movie'
, S.SName 'Staff Name'
from movie as M
left join screen_movie as sc ON M.MovieID = sc.MovieID
left join booking as b ON sc.screen_Movie_ID = b.screen_Movie_ID
left join staff as S ON b.SID = S.SID
union
select M.MName 'Movie'
, S.SName 'Staff Name'
from movie as M
right join screen_movie as sc on M.MovieID = sc.MovieID
right join booking as b ON sc.screen_Movie_ID = b.screen_Movie_ID
right join staff as S ON b.SID = S.SID