[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Ideas to substitute for a [query] inside a [query]?
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.
[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;
|
]
[set this_cat_search][sql-param category][/set]
[seti covered_sku_list][mvasp tables="products"]<%
my $dbh = $Sql{products};
my $sql_query = "SELECT sku FROM products WHERE category =
'$Scratch->{this_cat_search}' AND hcpcs IN ( SELECT hcpcs FROM coverage
WHERE carrier_idr = '$Values->{carrier_pri}') ORDER BY category;";
my $sth = $dbh->prepare($sql_query)
or return error_message("can't open products database");
my $rc = $sth->execute()
or return HTML("can't open products database");
while ( $sku = $sth->fetchrow_arrayref() ) {
HTML("$sku->[0]|");
}
return;
%>[/mvasp][/seti]
[page href="scan"
arg="
fi=products
sp=results
st=db
co=yes
sf=sku
se=[scratch covered_sku_list]nada
"]
[sql-param category]
[/page]
<BR>
[/query]
At 08:15 PM 2/14/2001 -0800, you wrote:
>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
>
>
>_______________________________________________
>Interchange-users mailing list
>Interchange-users@lists.akopia.com
>http://lists.akopia.com/mailman/listinfo/interchange-users
Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users