[ic] Nesting queries

Dan B interchange-users@lists.akopia.com
Tue Jul 3 20:36:00 2001


At 04:54 PM 7/3/2001 -0700, you wrote:
>Is it possible to nest [query] tags? I have one [query] that lists top level
>categories and would like to list the selected subcategories with the main
>category using another [query].
>
>          [query list=1 st=db sql="select * from categories where
>parent=null"]
>          ... display main cat ...
>          [if sql-code = [data session arg]]
>          [then]
>              [query list=1 st=db sql="select * from categories where
>parent='[data session arg]'"]
>              ... display sub-cat ...
>              [/query]
>          [/then]
>          [/if]
>          [/query]
>
>Thanks,
>
>Peter

I asked the exact same question a few months ago.  Use the prefix="" 
directive, as documented.  Here is an example:

[query prefix="outer" ...]
         ...
         [outer-param code]
         ...
         [query prefix="inner" ...]
                 ...
                 [inner-param code]
                 ...
         [/query]
         ...
[/query]


Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com