table structure
userID SponserID
102 200
201 102
202 102
203 201
all users have parend id means sponser ID how to find all records which are which are userd of 102
pls help me
table structure
userID SponserID
102 200
201 102
202 102
203 201
all users have parend id means sponser ID how to find all records which are which are userd of 102
pls help me
Use these queries:
For getting all records of userID 102
select * from tablename where userID=102
For getting all records where Parent is 102
select * from tablename where SponserID=102
If you have a real nested tree and are interested in finding all children of a particular node, not limited to direct children, you should start by reading this article: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html