[ic] Ideas to substitute for a [query] inside a [query]?

Mike Heins mikeh@minivend.com
Fri, 16 Feb 2001 15:40:59 -0500

Quoting Dan B (db@cyclonehq.dnsalias.net):
> Solved it, works perfect.  :-)  Thanks to Christopher F. Miller and the 
> mailing list archive.  Hopefully this will come in handy to the next person 
> searching the archives.

And though I jumped in late, there actually isn't any reason you can't nest a 
query. I don't know why I never remembered to remove the "canNest" check for
Tagref.pm, but that is actually a legacy from the less-capable MV3 parser.

This nested query:

    [query list=1 prefix=outer sql="select category from products"]
                list=1 prefix=inner
                    SELECT sku,description
                    FROM products
                    WHERE category = '[outer-code]'
                "][outer-code] : [inner-code] : [inner-param description]<BR>

seems to work fine. Of course you have to have separate prefix= things
so the placeholders get substituted correctly, but it will work. As will
a loop in a loop, etc. Not the best way to get great performance, though. 8-)

Red Hat, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <mheins@redhat.com>

Experience is what allows you to recognize a mistake the second
time you make it. -- unknown