I have two fields say userID and RefID in database. UserID is a unique value each time but refID can be duplicate, as each userID is reffered by another userID who become refid of the UserID. Now I want to calculate the no of userIds at each level in the tree. Tree can have any no. of branches.How this can be done? please help.