I have a parent and child information in same table now I have to delete the child records which is having count more than ten for a single parent.
I was able to get count of child for each parent but I was not able delete only the child records having count more than ten for a parent and I should retain parent record and only delete child records
select parent,count(child) from table group by parent having count(child >10);
It gives results:
Parent. | Count(child)
1053. | 15
3052. | 30
3467. | 45
Now I have to delete only the count of child records more than 10 and I tried different ways but didn't help me.Any help is appreciated.