A
A
Alex Lafa2021-12-21 16:14:33
Database
Alex Lafa, 2021-12-21 16:14:33

Create a database report?

there are 2 tables that are connected code.table1=id1.table2

table 1
Code name adress rik plz plj prim
1 Ivanov II pr
. Kropyvnytskogo 34 -56-78 02.12.2021 250 125 acceptance based on previous data
3 Sidorov OO vul. Partizanska 23 apartment 43 04.12.2021 45 34

Table 2
Code id1 litera name rzp rjp
1 1 A1a1 house 120 95
2 1 B barn
3 1 V cellar
4 2 A1a1a2 living house 250 125
5 2 B o tnya kitchen 0 0 0
2 0
7 3 A1 living house 45 34
8 3 D shed

question?????
how to make a request for a report, so that it turns out to display information from the first table and the second one by code????
e.g.
1 Ivanov II
pr .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Derepko, 2021-12-21
@uDenX

https://ru.wikipedia.org/wiki/Join_(SQL)

S
Slava Rozhnev, 2021-12-21
@rozhnev

select * 
from table1
left join table2 on table1.code = table2.id1
where table1.code = 1;

MySQL LEFT JOIN fiddle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question