vendredi 29 juillet 2016

Group parents with same children

I have a table like this

ID  Type                    ParentID
1   ChildTypeA              1
2   ChildTypeB              1
3   ChildTypeC              1
4   ChildTypeD              1

5   ChildTypeA              2 
6   ChildTypeB              2
7   ChildTypeC              2

8   ChildTypeA              3 
9   ChildTypeB              3
10  ChildTypeC              3
11  ChildTypeD              3

12  ChildTypeA              4
13  ChildTypeB              4
14  ChildTypeC              4

and I want to group parents that have same children - meaning same number of children of same type.

Example of my output would be:

Config Group    ParentID
ConfigA         1   
ConfigA         3   
ConfigB         2
ConfigB         4

I have no idea where to even begin.

Aucun commentaire:

Enregistrer un commentaire