[SOLVED] Comparation in MSQL two comparations


I have two tables (movies and genders).
"Genders" contains the gender with an ID to identify each (Action = 1, Drama = 2…etc.);
And Peliculas contains many columns with info plus a Gender id which identify the gender of the movie.

I am trying to do a selection where the years are Between xx and xx years (this is done) and at the same time bring up the movies with an specific gender.

I have try many things like this:

select *
from pelicula p
where anio between 1995 and 1996 
    and select id 
    from genero g 
    where g.nombre = "Action" = p.genero_id;


Try using a join.

Select * 
from pelicula p

Left Join genero g
p.genero_id = g.id 

where anio between 1995 and 1996 
and g.nombre = "Action";

Answered By – Brandon R

Answer Checked By – Marie Seifert (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *