I commented on this topic in another forum topic but chose break the scenarios out in more detail here. My query question maybe best served if it is broken into 2 seperate queries. See below.
1. I was looking to find all groups where permissions are applied in CS (including, ancestors, parents & children)? I wasn't getting the results using the query below
Select A.ID, A.Name from Kuaf A
Where A.Type = 1 And A.ID IN (Select distinct DTA1.RightId From DtreeACL DTA1 where A.ID = DTA1.RightId)
AND A.ID IN (Select distinct KC.Id from kuafchildren KC join DtreeACL DTA2 on DTA2.RightId = KC.Id Where KC.ChildId = A.Id)
AND A.Deleted = 0
Order by A.Name;
2. Secondly, would be to display all the folders each group is permissioned on.