Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
--Setup
DECLARE @T TABLE (c1 CHAR(1), c2 CHAR(1), c3 CHAR(1))
INSERT @T
SELECT 'x', 'y', '0'
UNION ALL SELECT 'x', 'c', 'y'
UNION ALL SELECT 'x', 'n', 'c'
UNION ALL SELECT 'x', 'a', 'b'
UNION ALL SELECT 'x', 'b', 'n'
;
-- Declare CTE
WITH Temp
AS
(
SELECT
c1,
c2,
c3,
0 AS Level
FROM
@T as T
WHERE
c3 = '0'
UNION ALL
SELECT
T1.c1,
T1.c2,
T1.c3,
Level + 1
FROM
@T AS T1
INNER JOIN
Temp AS T2
ON T1.c3 = T2.c2
)
-- Get results
SELECT *
FROM Temp