[ic] query sql

Frank interchange-users@icdevgroup.org
Thu Dec 19 07:12:00 2002


Paul Jordan wrote:
> 
> > I'm trying to speed up my interchange by using the [query sql ...]
> > tag instead of [loop search ...] and got it run in most cases
> > (and it is about 200 times faster!!!) What I did is to change the
> >
> > [loop search="se=dmm/sf=rub/ml=1"]
> > ....
> > [/loop]
> >
> >  into
> >
> > [query sql = "SELECT code, thumb, ab_price, product
> >               FROM products
> >               WHERE rub = 'dmm'"
> >               type=list]
> > [list]
> > ...
> > [/list]
> > [/query]
> >
> > Now I got the problem that I need to search a substring
> > and then I have to sort the results.
> >
> > The [loop search .....] syntax I use is:
> >
> > [loop search="se=dmd/sf=rub/su=yes/tf=rub/ml=15"]
> > ...
> > [/loop]
> >
> > Is there any equivalent [query sql ....] tag for that???
> >
> > I had no chance with what I was trying:
> >
> > [query sql = "SELECT code, thumb, ab_price, product
> >               FROM products
> >               WHERE rub LIKE 'dmd%'"
> >               type=list
> >               ml=15 ]
> > [list]
> > ...
> > [/list]
> > [/query]
> >
> > Any ideas for doing better??
> > How can I sort the result??
> >
> > Thank you for your support
> >
> > Frank
> 
> Try:
> 
>  [query
>          ml=15
>          type=list
>          sql="
>                SELECT code, thumb, ab_price, product
>                FROM products
>                WHERE rub = 'dmm'
>                ORDER BY rub
>              "]
> 
> ....rest of code
> 
> Paul

OK, thanX, now I just have one problem left:
I need to search for a substring in the field rub.
I have 'dmd1', 'dmd2', 'dmd3' .... in products and need to 
find them all with the query tag.
I tried 'normal' SQL-Syntax, but 

the -->WHERE rub LIKE 'dmd%'<-- from the above example is not working.

What do I have to write as a placeholder? The '%' doesn't work.

Frank