Hi i am currently studying sql and I have 2 one to many tables but I do not understand how to combine them to a many to many. I have a joining table.
table parent
columns parent and parent id
table child
columns child and childid
table parentchild –(Join table selecting parents with childid)
columns parentid and childid
Here is my codes.
select parent.name, parentchild.childid from parent
join parentchild
on parent.parentID = parentchild.parentid
select child.name, parentchild.parentid from child
join parentchild
on child.childID = parentchild.childid
The solution is to write a single query which joins the
parenttable to theparentchildtable and then join theparentchildtable to thechildtable.