hey, i need to make a query in mssql and have no idea where to start. thought i'd see if anyone here could help me out. i've got a table named page_links connecting parent groups to their subgroups with fields Parent_ID Child_ID ... i need this query to ensure that if someone attempts to delete a connection between two groups in my application, both groups will still be connected to one of the main groups in the hierarchy. so. i have a list of 8 groups and at least one of them needs to be an ancestor of the group in question.. i.e. if we only went up one level SELECT * FROM page_links WHERE Child_ID IN (someID) AND Parent_ID IN (list of 8 groups) and so if this returned any rows i would know that it's connected else where and allow the deletion. but if this didn't return any rows i would want it to loop over, replacing the someID with each of the groups parent_ID's.. and have this continue until the group no longer has any parents to check and it's parents have no more parents to check and so on. i guess this would be the pseudo for what i want done. child -> somegroupID while the parent list isn't empty populate the new parent list from child -> parlist if parlist contains one of (8 main group id's) return true else if parlist = null return false else child -> parlist end while i think that basically sums it up.. also there would need to be some sort of conditions to ensure there is no infinite looping, since their may be strange group connections like g1-> g2 -> g3 -> g1.. so it would have to guard against groups being added to the child list that have already been there anyways, i realize this is a fair amount of work to ask for someone to do.. but that's why i need the help.. any ideas are appreciated