Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recursivity (Interbase).

Status
Not open for further replies.

RFBCAN

Programmer
Joined
Aug 12, 2015
Messages
1
Location
CA
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)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top