Reputation: 137
I have a database from which I need to JOIN
4 tables and I am having some trouble figuring it out
I have the following tables
A. id, name, picture, d_id
B. id, name
C. id, a_id, b_id, commentaar
D. id, name
Does anyone have any idea how to go about this? A
has data used in D
and C
has data used in A
and B
, so I am at a loss how to get this one done. I want to output
A.name, A.picture, B.Name, C.commentaar, D.name
Upvotes: 0
Views: 47
Reputation: 16917
Unless I'm missing something, you just need to do this:
Select A.name, A.picture, B.Name, C.commentaar, D.name
From A
Join D On A.d_id = D.id
Join C On C.a_id = A.id
Join B On C.b_id = B.id
Upvotes: 4