这是我正在使用的查询.我收到此查询错误. ‘WITH’子句附近的语法错误.
原文链接:https://www.f2er.com/sqlite/197883.htmlWITH RECURSIVE under_cust (affiliation_id,from_customer_id,to_customer_id,to_name,parent_customer_type,child_customer_type,level) AS (SELECT af.affiliation_id,0 LEVEL FROM affiliation af,customer c WHERE to_customer_id <> from_customer_id AND af.from_customer_id = c.customer_id AND af.to_customer_id = 1000022559337 UNION ALL SELECT af.affiliation_id,af.from_customer_id,af.to_customer_id,af.to_name,af.parent_customer_type,af.child_customer_type,under_cust.level + 1 LEVEL FROM customer c,affiliation af JOIN under_cust smr ON smr.from_customer_id = af.to_customer_id WHERE af.from_customer_id = c.customer_id ) SELECT affiliation_id,to_customer_id parent,from_customer_id child,level FROM under_cust