日期:2014-05-18  浏览次数:20572 次

SQL CTE递归问题
SQL code

;WITH T AS
    (
      SELECT MemberNo , ParentMemberNo,MemberName,AccountType,InDate,AuditDate
      FROM View_GetMember
      WHERE MemberNo = 'as4234426'
      UNION ALL
      SELECT A.MemberNo , A.ParentMemberNo,A.MemberName,A.AccountType,A.InDate,A.AuditDate
      FROM View_GetMember AS A  JOIN T AS B ON A.ParentMemberNo = B.MemberNo
    )
SELECT * FROM T 
消息 530,级别 16,状态 1,第 1 行
语句被终止。完成执行语句前已用完最大递归 100。



求各位帮忙看下..才学习CTE

------解决方案--------------------
看下你表中数据是否存在对应多个父级id的。。。