F
F
FAwafawf12122021-05-25 06:55:45
SQL Server
FAwafawf1212, 2021-05-25 06:55:45

How to make a query linking one table to another?

There are 2 tables. One contains field 1Id field 2 name field 3 something else field 4 item id, the second table contains the item id field and the model field.
Table example 1.
1-ball-red-2
table example 2.
2-football.
They are connected in the schema by field 4 of the first table and 1 by the field of the second table.
It is necessary that in the end we get 1 table,
for example
, 1-ball red- 2-football
tried to do it through left JOIN, it combines them, but only if I use * FORM table, if I list columns, there will be no merging, why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2021-05-25
@FAwafawf1212

SELECT таблица1.поле1, таблица1.поле2, таблица1.поле3, таблица1.поле4, таблица2.поле2
  FROM таблица1
    INNER JOIN таблица2 ON таблица2.поле1 = таблица1.поле4

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question