I have a single table that can refer to one other member in the table as a parent. That parent could also refer to one other row as its parent...and so on.
id col1 col2 parentID
1 foo bar NULL
2 blah boo 1
3 fob far 2
4 wob lob NULL
I would like to return the chain given an id. So if the id were 3 I would return row 3, row 2 and row 1. If id was 2 I would return row 2 and row 1. If the id were 1 or 4 I would just return that row.
thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…