在此SQL代码中使用“ INTERSECT”有什么问题

时间:2019-12-30 22:03:09

标签: sql intersect

(
 Select Movie_Name
 From Theatres Inner Join Movies
 On Theatre_Movie_ID = Movie_ID AND Showing_Time = '9:00PM'
) 

INTERSECT 

( 
 Select Movie_Name
 From Movies
 Where Duration = '2:20' 
)

1 个答案:

答案 0 :(得分:1)

如上述@ jason-goemaat所建议。由于电影已经有了JOIN,我们可以在Duration中添加WHERE子句:

 Select Movie_Name
 From Theatres Inner Join Movies
 On Theatre_Movie_ID = Movie_ID
 Where Movies.Duration = '2:20' AND Theatres.Showing_Time = '9:00PM'