V
V
valexandershmakov2022-03-19 10:55:59
SQL
valexandershmakov, 2022-03-19 10:55:59

Outputting two different values ​​from two different tables linked by a third?

62358b6b9ebee634128691.png
How can I display the number of the specialty and the last name of the student

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2022-03-19
@valexandershmakov

JOIN
If anything - JOIN can be chained, that is, table1 JOIN table2 ON ... JOIN table3 ON ...

B
Beliyadm, 2022-03-21
@beliyadm

select st.surname, s.spcode
from st_student as st
join st_student_spec as sst on st.id = sst.student_id
join st_spec as s on s.id = sst.spec_id

If we take into account the structure that a student can have different specialties (but the data in the example is still curves, there should not be complete duplicates in the student.specialty)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question