2010-09-14 75 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