I have the following table:
myTable:
+----+----------+
| id | parentID |
+----+----------+
| 1 | null |
| 2 | 1 |
| 3 | 1 |
| 4 | 2 |
| 5 | 4 |
-----------------
i would like to get all rows tracing back until there's no parentID anymore.
So ".... WHERE id=5" would give me:
5, 4, 2, 1
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…