Hi,
as per your info provided, check this...
SELECT UserId, ParentId,name from yourTable WHERE UserId in
(
SELECT ParentId from yourTable where UserId=5
)
union
SELECT * from yourTable where ParentId=2
Hope this will give your required output.
Cheers