Wednesday, April 10, 2013

Get repeated rows in based on child table from Parent table

SELECT * 
FROM `parents` 
WHERE id
IN (

SELECT parent_id
FROM `tbl_parent_child` 
GROUP BY parent_id
HAVING COUNT( parent_id ) =2
)