qq_39464862
qq_39464862
2018-11-16 09:01

语句被终止。完成执行语句前已用完最大递归 9

  • sql

with cte(u_name,u_referess) as (select u_name,u_referess from userMember where u_referess = 'ceshi' union all select t.u_name,t.u_referess from userMember as t inner join cte as c on t.u_referess = c.u_name ) select COUNT(distinct u_name) from cte option (maxrecursion 9)
我只想递归9次并获取对应的总人数数据,但是报错:语句被终止。完成执行语句前已用完最大递归 9。如何解决控制递归次数不报错并获取对应层数的总人数数据。

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答