大发体育娱乐在线-大发体育娱乐官方网站-大发体育娱乐登录网址
做最好的网站

SqlServer递归查询

来源:http://www.dfwstonefabricators.com 作者:数据库 人气:187 发布时间:2019-09-22
摘要:1 DECLARE @ParentId NVARCHAR(36); 2 SET @ParentId = '078499bf-dedd-b293-4653-7bf6a2e54cbb'; 3 4 WITH [Temp] AS 5 ( 6 SELECT [A].* FROM [dbo].[Contacts] A WHERE [A].[ParentID] = @ParentId AND [A].[IsDefault] = 1 7 UNION ALL 8 SELECT [A].* FR
 1 DECLARE @ParentId NVARCHAR(36);
 2 SET @ParentId = '078499bf-dedd-b293-4653-7bf6a2e54cbb';
 3 
 4 WITH [Temp] AS
 5 (
 6     SELECT [A].* FROM [dbo].[Contacts] A WHERE [A].[ParentID] = @ParentId AND [A].[IsDefault] = 1
 7     UNION ALL
 8     SELECT [A].* FROM [dbo].[Contacts] A INNER JOIN [Temp] B ON A.[ParentID] = B.[ObjectID] AND [A].[IsDefault] = 1
 9 )
10 SELECT * FROM [Temp] ORDER BY [Temp].[GlobalSort] ASC;

本文由大发体育娱乐在线发布于数据库,转载请注明出处:SqlServer递归查询

关键词:

上一篇:没有了

下一篇:没有了

频道精选

最火资讯