You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WITH one AS ( SELECT1 )
SELECT*FROM one;
WITH twoCol( a, b ) AS ( SELECT1, 2 )
SELECT a, b FROM twoCol;
WITH fooCTE AS (SELECT*FROM foo)
SELECT*FROM fooCTE;
WITH aCTE AS (SELECT'a'),
bCTE AS (SELECT'b')
SELECT*FROM aCTE, bCTE;
WITH RECURSIVE finite AS (
SELECT1UNION ALLSELECT*FROM finite LIMIT2
)
SELECT*FROM finite;
WITH RECURSIVE ten(x) AS (
SELECT1UNION ALLSELECT x+1FROM ten WHERE x<10
)
SELECT*FROM ten;
WITH RECURSIVE dates(x) AS (
SELECT'2015-01-01'UNION ALLSELECTDATE(x, '+1 MONTHS') FROM dates WHERE x<'2016-01-01'
)
SELECT*FROM dates;
WITH RECURSIVE list( element, remainder ) AS (
SELECTNULLAS element, '1,2,3,4,5'AS remainder
UNION ALLSELECT
CASE
WHEN INSTR( remainder, ',' )>0 THEN
SUBSTR( remainder, 0, INSTR( remainder, ',' ) )
ELSE
remainder
END AS element,
CASE
WHEN INSTR( remainder, ',' )>0 THEN
SUBSTR( remainder, INSTR( remainder, ',' )+1 )
ELSE
NULL
END AS remainder
FROM list
WHERE remainder IS NOT NULL
)
SELECT element FROM list WHERE element IS NOT NULL;
WITH RECURSIVE approvers(x) AS (
SELECT'Joanie'UNION ALLSELECTcompany.approverFROM company, approvers
WHEREcompany.name=approvers.xANDcompany.approverIS NOT NULL
)
SELECT*FROM approvers;
May God help us reach this level of dynamic query support!!!
Best regards,
Juan Dent
The text was updated successfully, but these errors were encountered:
Just to have them all in one place, I am placing the examples of the WITH clause in this issue as found in the document you shared with me the other day: (https://blog.expensify.com/2015/09/25/the-simplest-sqlite-common-table-expression-tutorial/)
May God help us reach this level of dynamic query support!!!
Best regards,
Juan Dent
The text was updated successfully, but these errors were encountered: