select  * from groups where WParentGroup2ID in
(

select a.WGroupid from groups a where a.WGroupTypeId = 2000 and (a.WParentGroup2ID = 0 or a.WParentGroup2ID is null)
)