Probably I dont ask the title well.
I have three tables as shown in the figure.
I want to get the column x
in table C
where wid
is in table B
. Some of the wid
in table C
is not needed, I want only wid
s that their mid
in table B
are in table A.
Can you help me to solve this?
CodePudding user response:
Joining tables on primary key = other table's foreign key. There are inner/outer left and equi joins. Read on it.
select A.Mid, C.X
from A
left join B on B.Mid = A.Mid
join C on C.Wid = B.Wid