Skip to content
Advertisement

Two Inner Joins MYSQL

How would I preform two inner joins in one query?

Ie: three tables

Invoice
Address
Client

Invoice has a column which references an id in clients. It also has a column which references an address. I need to get both the clients name from the matched table and the address from the matched table. How would I INNER JOIN both tables?

I’ll add a few details…
invoice has rows address(references address id), client(references client id), id and notes client has rows first_name, last_name address has rows street_name and city

I need to pull up

Advertisement

Answer

You can have as many JOIN clauses as you need in the query. Each has an ON clause where you specify the related columns between the joined tables.

SELECT
  columns
FROM
  invoice
INNER JOIN
  address
ON
  join_condition
INNER JOIN
  client
ON
  join_condition
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement