user3501183
user3501183

Reputation: 15

Join two tables into one without repeating id in SQL

I'm trying to show the informacion I have in the tables "caractersiticas" and "Control" without including "codigoMaterial" which is related to "codigo".

I have tried this:

SELECT *
FROM caracteristicas
JOIN control
  ON codigo = codigoMaterial

I get all the results from both table and I don't want it to show one entire column. What shoud I do?

Upvotes: 0

Views: 50

Answers (1)

Dave Jemison
Dave Jemison

Reputation: 704

SELECT * means show all the columns. Otherwise, you'll need to specify the columns you do want to show. You can also alias your tables to make reading easier:

SELECT car.Field1, car.Field2, cont.FieldA, cont.FieldB
FROM caracteristicas car
JOIN control cont
  ON car.codigo = cont.codigoMaterial

Upvotes: 1

Related Questions