Subject Re: [firebird-support] Tree Sql query
Author Martijn Tonies
Hi,

> I have tree structure in my application and i need to write a sql
> for this tree structure.
> This is my scneario.
>
> Nod_id Parent_node_id level_id
>
> 1001 1001 1
> 1002 1001 2
> 1003 1001 2
> 1004 1002 3
> 1005 1002 3
> 1006 1003 3
> 1007 1003 3
>
> If i say node_id=1002, i should get all the nodes under 1002 and
> 1002.My output should be 1002,1004,1005 like this.

Try a recursive selectable stored procedure.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com