2010-09-14 69 views
0

表结构我无法搜索树在PHP MySQL的

userID SponserID 
102   200 
201   102 
202   102 
203   201 

所有的用户都parend ID意味着sponser ID 如何找到这些都是纪录内的102

userd请帮助我

+0

“查找所有记录是哪个用户102”...? 'SELECT ... WHERE userid = 102'?我想你可能想解决你的问题。 – deceze 2010-09-14 04:09:00

回答

0

使用这些查询:

  • 为了得到所有记录用户ID 102

    select * from tablename where userID=102

  • 为了让所有的记录,其中母公司为102

    select * from tablename where SponserID=102