WITHRECURSIVE graph_depds AS ( SELECT node,pre_nodes FROM mytest a WHERE node ='f' UNIONALL SELECT a.node,a.pre_nodes FROM mytest a, graph_depds b WHERE strpos(a.pre_nodes, b.node) >0 ) SELECTDISTINCT node,pre_nodes FROM graph_depds ORDERBY node;
WITHRECURSIVE graph_depds AS ( SELECT node,pre_nodes FROM mytest a WHERE node ='i' UNIONALL SELECT a.node,a.pre_nodes FROM mytest a, graph_depds b WHERE strpos(b.pre_nodes,a.node) >0 ) SELECTDISTINCT node,pre_nodes FROM graph_depds ORDERBY node;