Top "Recursive-cte" questions

A Recursive Common Table Expression in SQL is a Common Table Expression (CTE, also known as "WITH clause") that refers to itself recursively.

Get all parents for a child

I want to retrieve the parentid of an id, if that parentid has a parent again retrieve it, and so …

sql-server tsql recursion hierarchy recursive-cte
To find infinite recursive loop in CTE

I'm not a SQL expert, but if anybody can help me. I use a recursive CTE to get the values …

sql recursive-cte
Recursive CTE-Find all Employees Below Manager

I created a sample fiddle for this SQLFIDDLE CREATE TABLE [dbo].[Users]( [userId] [int] , [userName] [varchar](50) , [managerId] [int] , ) INSERT INTO …

sql .net sql-server recursive-cte
Does PostgreSQL have a pseudo-column like "LEVEL" in Oracle?

Does PostgreSQL have a pseudo-column like "LEVEL" in Oracle? If not, then how can we create a column similar to "…

oracle postgresql connect-by hierarchical-query recursive-cte
Find All employees reporting to manager, including managers employees

I have a table with at least three columns, EMPLID, NAME, SUPERVISOR_ID. In a single query, I'd like get …

sql sql-server-2008 tsql sql-server-2012 recursive-cte