0

这篇文章的答案在这里提供了一个查询来查找邻接列表中节点的所有祖先。

现在,如何使用类似查询找到节点的所有后代?我试过了:

SELECT  @id :=
        (
        SELECT  receiverid
        FROM    mytable
        WHERE   senderid = @id
        ) AS person
FROM    (
        SELECT  @id := 5
        ) vars
STRAIGHT_JOIN
        mytable
WHERE   @id IS NOT NULL

我只是交换 senderid 和 receiverid,但它给了我#2014 Commands out of sync. You can't run this command now.

任何想法?

4

0 回答 0