I haven't used SQLite
before and can't figure out the syntax, I have this working in SQL Server
if it helps.
I need to put the results into a temp table so I can reuse them.
//SQL Server
WITH FT_CTE AS
(
SELECT pID, cID FROM brFTNode_Children
WHERE pID = 1
UNION ALL
SELECT e.pID, e.cID FROM brFTNode_Children e
INNER JOIN FT_CTE ftCTE on (ftCTE.cID = e.pID)
)
SELECT * INTO #ParentChild FROM FT_CTE;
//SQLite try
WITH FT_CTE AS
(
SELECT pID, cID FROM brFTNode_Children
WHERE pID = 1
UNION ALL
SELECT e.pID, e.cID FROM brFTNode_Children e
INNER JOIN FT_CTE ftCTE on (ftCTE.cID = e.pID)
)
CREATE TEMPORARY TABLE ParentChild as SELECT * FROM FT_CTE;
I get Error near "CREATE": syntax error
The CREATE TABLE statement does not allow CTEs, but the SELECT does:
CREATE TEMPORARY TABLE ParentChild AS
WITH FT_CTE AS (
SELECT pID, cID FROM brFTNode_Children
WHERE pID = 1
UNION ALL
SELECT e.pID, e.cID FROM brFTNode_Children e
INNER JOIN FT_CTE ftCTE ON (ftCTE.cID = e.pID)
)
SELECT * FROM FT_CTE;