我有这张table user_id
以及 father_id
. 我要选择所有 father_id
与 user_id
直到 father_id = 0
并以逗号分隔的格式存储它们。
表格: network
```
select user_id, father_id from network where user_id = 1762;
user_id father_id
1762 1761
select user_id, father_id from network where user_id = 1761; -- resulting father_id from the first query
user_id father_id
1761 1760
select user_id, father_id from network where user_id = 1760; -- resulting father_id from the second query
user_id father_id
1760 0
在这个例子中,我想得到 `father_id` 直到我到达 `father_id = 0` 通过使用结果 `father_id` 作为 `next user_id` .
暂无答案!
目前还没有任何答案,快来回答吧!