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

Dan B db@cyclonehq.dnsalias.net
Wed, 14 Feb 2001 20:15:15 -0800


Since Interchange cannot do a [query] inside a [query] (docs say "Nesting: 
NO"), what can I use to get the same functionality?

Here's the current code (working):
[query
         list=1
         st=db
         sql=|
                 SELECT  DISTINCT category
                 FROM    products
                 WHERE   hcpcs IN (
                                 SELECT  hcpcs
                                 FROM    coverage
                                 WHERE   carrier_idr = '[value carrier_pri]'
                                 )
                 ORDER BY category;
         |
]
         [sql-param category]<BR>
[/query]

It just lists the categories.  But I would like to link the categories with 
a very specific link, based on some values I get from a different query....

[query
         list=1
         st=db
         sql=|
                 SELECT  DISTINCT category
                 FROM    products
                 WHERE   hcpcs IN (
                                 SELECT  hcpcs
                                 FROM    coverage
                                 WHERE   carrier_idr = '[value carrier_pri]'
                                 )
                 ORDER BY category;
         |
]
         [page href="scan"
                 arg="
                 fi=products
                 sp=results
                 st=db
                 co=yes
                 sf=category
                 se=[query
         list=1
         st=db
         sql=|
                 SELECT  sku
                 FROM    products
                 WHERE   category = '[sql-param category]'
                 AND             hcpcs IN (
                                 SELECT  hcpcs
                                 FROM    coverage
                                 WHERE   carrier_idr = '[value carrier_pri]'
                                 )
                 ORDER BY category;
                 |
         ][sql-param sku]|[/query]"
         ]
         [sql-param category][/page]<BR>
         [comment] The above [page] code would result in something like 
se=3245|5894|6546|7657|3124|  [/comment]
[/query]

Does anyone have any good ideas about what kind of [calc] I should try to 
get these kind of results?  Is there any code samples already of the 
[query] functionality done in perl?

Thanks,


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