Subject Re: [firebird-support] Re-entrant Queries
Author Lee Jenkins
Svein Erling Tysvær wrote:
>
>
> It doesn't take long to get used to simple CTEs, Sean. From the top of
> my head (i.e. not tested at all and possibly full of syntax errors):
>
> WITH RECURSIVE TourneySubtourney(OID, MyLevel) AS (
> SELECT T.OID, cast(1 as Integer)
> FROM Tourneys T
> WHERE T.ParentOID is null
> UNION ALL
> SELECT TChild.OID, TParent.MyLevel+1
> FROM TourneySubtourney TParent
> JOIN Tourneys TChild on TParent.ParentOID = TChild.OID)
>
> SELECT * FROM TourneySubtourney

Thanks for posting. I wonder, is there no way to do this strictly through
generic SQL? I ask because the main application will be using FB2.1 but
supporting web applications (where some of the data including tourneys from the
FB database will be pushed to) that use MySQL.

Thanks again for everyones help,

--
Warm Regards,

Lee