[ic] How to make a query disappear...or [query help] (is there a bug in IC's query ability?)

Kevin Walsh interchange-users@icdevgroup.org
Fri Jul 26 18:24:00 2002


> I've tried every permutation that I can think of:
> I have tried leaving out the tablenames in the select statement as well as
> the [sql-param field] tags.  I've tried using the INNER JOIN ... ON syntax.
> basic code:
> 
> [query sql="SELECT orderline.sku, orderline.quantity, orderline.subtotal,
> transactions.lname, transactions.fname, transactions.status,
> transactions.comments FROM orderline, transactions WHERE
> orderline.order_number = transactions.order_number"
>       type=list
>       more=1
>         ml=50]
>
>    [on_match]Matched<br>[/on_match]
>       [no_match]Not Found<br>[/no_match]
>       [list]
>         [sql-param sku] [sql-param lname] [sql-param therestofthefields]<BR>
>       [/list]
>       [more_list]
>         [more]
>       [/more_list]
>    [/query]
> 
You could rewrite your query as the following:

    [query type=list more=1 ml=50 sql=|
        SELECT  o.sku AS sku,
                o.quantity AS quantity,
                o.subtotal AS subtotal,
                t.lname AS lname,
                t.fname AS fname,
                t.status AS status,
                t.comments AS comments
        FROM    orderline o, transactions t
        WHERE   o.order_number = t.order_number
    |]
        ...
    [/query]

Or you could use [sql-pos 0], [sql-pos 1] etc in your existing code.
[sql-pos 0] refers to the first column in the resultset, [sql-pos 1]
refers to the second etc.

I personally prefer the re-written query.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/