Subject Re: [firebird-support] Revursive Stored Procedure
Author jft
James - see this recent thread ...
http://tech.groups.yahoo.com/group/firebird-support/message/86490
HTH,
John
> -------Original Message-------
> From: James N Hitz <jamhitz@...>
> Subject: [firebird-support] Revursive Stored Procedure
> Sent: 11 Jun '07 19:20
>
> Supposing I had a list of Departments in a table like this:
>
> ID | DEPARTMENT | PARENTID
> 1 | INFO. TECH. | NULL
> 2 | ACCOUNTS | NULL
> 3 | SOFTWARE DEVLPT | 1
> 4 | REQUISITIONS | 2
> 14 | QUALITY ASSURANCE | 3
>
> What would be the best way to produce output showing the entire path for
> every "sub-department" (WHERE PARENTID NOT IS NULL ORDER BY 2) to get
> something like this:
>
> ID | DEPT_PATH
> 4 | ACCOUNTS - REQUISITIONS
> 3 | INFO. TECH. - SOFTWARE DEVLPT
> 14 | INFO. TECH. - SOFTWARE DEVLPT - QUALITY ASSURANCE
>
> I think a recursive Stored Proc. Any suggestions?
>
> Thanks
> James
>
>