Quantcast
Channel: SQL Server CTE Bottom to Top Recursive with Where clause - Database Administrators Stack Exchange
Browsing all 4 articles
Browse latest View live

Answer by Pantea for SQL Server CTE Bottom to Top Recursive with Where clause

This Link will help you a lot in learning Recursive CTEs with excellent and useful examples : https://www.codeproject.com/Articles/818694/SQL-queries-to-manage-hierarchical-or-parent-child.

View Article



Answer by Darren G for SQL Server CTE Bottom to Top Recursive with Where clause

It looks like you had a tiny error when copying the example that you linked to - c.[EmployeeId], c.[name], c.managerId, 0 AS [Level]should bec.[EmployeeId], c.[name], c.managerId, 1 AS [Level]Once I...

View Article

Answer by Randi Vertongen for SQL Server CTE Bottom to Top Recursive with...

Swapping the columns in the inner join in the recursive part is a way to go about this.Join columns changed from t.[EmployeeId]=s.managerId to s.[EmployeeId]=t.managerIdI deleted some parts that did...

View Article

SQL Server CTE Bottom to Top Recursive with Where clause

I have an Employee Table with an EmployeeId, ManagerId and a Name field.The goal is to make a recursive With fetching all the rows from an employee to the top manager (ManagerId is null).I found this...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images