Inner Join Sql for a query of two tables

0

Hello friends I'm trying to make a query where I get elements from different tables, in this case, it's only for 2, I guess I can use a Inner Join but from what I understand this I It serves to relate tables. This is more or less what I want ...

select e.razon ,l.conf from eventos e
join listainvitados l
where idlistainvitados = 1
    
asked by E.Rawrdríguez.Ophanim 18.06.2018 в 18:58
source

1 answer

2

You need to have a common value between both relationships (tables).

Generally, when it comes to an EQUIJOIN (in 99% of cases it will be like this), your query will look something like this:

select e.razon ,l.conf from eventos e
  inner join listainvitados l on (e.evento_id = l.evento_id)
  where idlistainvitados = 1

Or, using the syntax using which is what I always prefer:

select e.razon ,l.conf from eventos e
  inner join listainvitados l using (evento_id)
  where idlistainvitados = 1
    
answered by 18.06.2018 / 19:05
source