Hello All.
Please could someone help me with an example of SQL for Interbase with recursivity?
I have a model for SQL Server that works very well but when it does not work on Interbase.
If possible could you please send an example in Interbase to rfbarrozo@gmail.com
Thank you very much.
The code in SQL Server is:
WITH MyCTE
AS (
SELECT FAMILYID , NULL PARENTID, 1 as GRAU, DESCRIPTION
FROM PRODUCT_FAMILIES
WHERE FAMILYID = 30
UNION ALL
SELECT S.FAMILYID , S.PARENTID, GRAU +1 , S.DESCRIPTION
FROM PRODUCT_FAMILIES AS S
INNER JOIN MyCTE ON S.PARENTID = MyCTE.FAMILYID
WHERE S.PARENTID <> S.FAMILYID
)
SELECT FAMILYID, PARENTID, GRAU, DESCRIPTION
FROM MyCTE
ORDER BY GRAU option (maxrecursion 0)
Please could someone help me with an example of SQL for Interbase with recursivity?
I have a model for SQL Server that works very well but when it does not work on Interbase.
If possible could you please send an example in Interbase to rfbarrozo@gmail.com
Thank you very much.
The code in SQL Server is:
WITH MyCTE
AS (
SELECT FAMILYID , NULL PARENTID, 1 as GRAU, DESCRIPTION
FROM PRODUCT_FAMILIES
WHERE FAMILYID = 30
UNION ALL
SELECT S.FAMILYID , S.PARENTID, GRAU +1 , S.DESCRIPTION
FROM PRODUCT_FAMILIES AS S
INNER JOIN MyCTE ON S.PARENTID = MyCTE.FAMILYID
WHERE S.PARENTID <> S.FAMILYID
)
SELECT FAMILYID, PARENTID, GRAU, DESCRIPTION
FROM MyCTE
ORDER BY GRAU option (maxrecursion 0)