I have two tables
They have Field1 and Field5 in common, so I have tried the following query:
Select Campo1, Campo2, Campo3, Campo4, Campo6
From Tabla1 T1
Inner join Tabla2 T2
On (T1.Campo1 = T2.Campo5)
expecting to have something like this:
But I don't know why it gives me as a result:
In addition to adding the result to me, it duplicates it :/ Does anyone have an idea? I have already tried UNION, Left Join and Right Join. Thank you
Check that in one of the two tables there is no duplicate information. If this is the case, remember to put the fields "field1" and "field5" as primary keys
primary key
in the column definition when creating the table.Something in the form
Or you can delete the duplicates and, only after doing so, create primary keys over those fields.
And re-run the query you have.
Or (I don't recommend this), at the end of your query, ask to display it with a
distinct
.