Reputation: 410
I have one table linked to another one (One-To-many (1:N) relationship). I'm trying to fetch the results from both tables with JOIN in MySQL, like so:
SELECT *
FROM parent_table
JOIN child_table
ON (parent_table_id = child_table_id)
WHERE parent_table_id = ?
Problem is that I can see the results from the parent table and only one result from the child table. How can I do to get one result from the parent table and all results from the child?
Upvotes: 0
Views: 57
Reputation: 416
i think you need to try like this,,try this
SELECT *
FROM parent_table
RIGHT OUTER JOIN child_table
ON (parent_table_id = child_table_id)
WHERE parent_table_id = ?
Upvotes: 2