Recursiv/hierarchical query?
Ruslan Zasukhin
sunshine at public.kherson.ua
Thu Jan 22 05:27:37 CST 2009
On 1/22/09 10:17 AM, "Bart Pietercil" <bart.pietercil at cognosis.be> wrote:
Hi Bart,
> For me an sql_function would be
>
> select collect_branch(tbl_a,
> link_to_follow,startfrom_recid,optional_nr_of_levels_before_returning)
> which would return the recid's of the collected record, so I could
> write this
>
> select tbl_a.* where recid in (select
> collect_branch(tbl_a,link_to_follow,aRecid))
>
> Maybe I am to focused on my short term needs and we should be able to
> give instead of a link_to_follow a join condition ?
Link itself is enough info
> Maybe add also a count_branch_depth(tbl_A,link_to_follow,aRecID) which
> would return the number of iterations before reaching the lowest level
> of the branch.
>
> Then we could write something like:
>
> if(count_branch_depth(tbl_A,link_to_follow,aRecID) > someNumber) then
> select tbl_a.* where recid in (select
> collect_branch(tbl_a,link_to_follow,aRecid,someNumber))
> else
> select tbl_a.* where recid in (select
> collect_branch(tbl_a,link_to_follow,aRecid))
> end if
I do not see sense because exists optional_nr_of_levels_before_returning
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list