I am working on a site for a client, and the back end needs to be able to do this:
Basically if a member obtains 10 of his or her own members, I need to add that user to the top level.
This gets the top level of members currently (need to add on to this statement)
select fname, membershipid from dc_tbl_membership WHERE parentid = 0
This gets the children
SELECT B.fname, B.middle, B.lname, B.idnumber, A.membershipid AS ParentId, B.membershipid AS ChildId FROM dc_tbl_membership A, dc_tbl_membership B WHERE A.membershipid = B.parentid AND A.membershipid = ‘ . $memid . ‘ ORDER BY A.parentid
My first thought was to use COUNT, but I am not sure how to use that information to make logical decisions later on..
Sorry if this is confusing, if you need any more info let me know, I will be watching this topic closely.