sqlmovies

Display the title and year for all of the films that were produced in the same year as any of the SH and CH films


Display the title and year for all of the films that were produced in the same year as any of the SH and CH films.

how would I bring up a result table showing the titles of the movies that were also made in same years as the movies from genre column?

table name (movies) year column (YR) genre column (genre) genre (SH) (CH) i really don't know how i would put this all together any help would be appreciated.


Solution

  • How about something like this?

    SELECT m1.year, m1.title
    FROM movies m1
    WHERE EXISTS (SELECT 1
                    FROM movies m2
                   WHERE m2.genre IN ('SH', 'CH')
                     AND m2.year = m1.year);