i would like to know how can i get all indirect parents of a child in a MySQL database.
My tabel looks like:
uid | referral_uid | created
9 | 8 | <timestamp>
10 | 9 | <timestamp>
11 | 9 | <timestamp>
12 | 10 | <timestamp>
So for example for uid=12 i would like to get the indirect referral_uids which are 8 and 9. For uid=11 the indirect parent would be only 8.
Can this be achieved in one sql query? Thank you
I have tried the following http://sqlfiddle.com/#!2/d30b4/8 using the mentioned link for recursive query. I am doing something wrong but i can't really figure it out what.