How to use INNER JOIN
with WHERE
?
I'm doing a INNER JOIN
with 3 tables.
I need a WHERE
to return only one record. I'm trying this way:
SELECT '*' FROM ('tabela1')
INNER JOIN 'tabela2' ON 'tabela1'.'id' = 'tabela2'.'id'
INNER JOIN 'tabela3' ON 'tabela2'.'id' = 'tabela3'.'id'
WHERE 'tabela1'.'id' = 12;
Only MySQL returns this error:
Column 'military_id' in where clause is ambiguous
I want to receive only one record in INNER JOIN
, not all of the table. How do I?