How to perform Querys that show a data of the row of the related foreign key?

0

Good afternoon I have a problem with Mysql, I need the query to the invoice table that I'm doing, show me the name of the IDs of the foreign keys that I have represented, for example:

INVOICE TABLE

IdFactura

1

IdPersona

6

IdTravel

4

PERSON TABLE

IdPersona

6

Name

Jose

TRAVEL TABLE

IdTravel

4

Travel

A

I need the query to show me:

IdFactura

1

Name

Jose

Travel

A

Try to make a query with nested selects but they can only return me 1 row, it throws me an error if the table of invoices have more records. I would really appreciate the help.

    
asked by Jason Torres 13.08.2017 в 02:39
source

1 answer

0

Linking the tables with inner join

select f.IdFactura, p.Nombre, v.Viaje  
    from factura f 
         inner join persona p
      on f.IdPersona = p.IdPersona
         inner join viaje v
      on f.IdViaje = v.IdViaje

View Execution

    
answered by 14.08.2017 в 02:54