[ic] complex sql select statements

John Allman interchange-users@icdevgroup.org
Tue Sep 10 13:14:01 2002


Rene Hertell wrote:

>>[seti mysqlvar]SELECT
>>code,descrip,longdescrip,featprod,template,sku,image,description,p
>>rice,pricel1,pricel2,pricel3,priceeu,priceeul1,priceeul2,priceiep,
>>priceiepl1,priceiepl2,pricecorp,pricecorpl1,pricecorpl2,pricecompusd
>>FROM cattable left outer join products on cattable.featprod=products.sku
>>where pcode=252 order by cattable.displorder[/seti]
>>[query arrayref=myref sql="[scratch mysqlvar]"]
>><!-- this container text is not used -->
>>[/query]
>>
>>[perl]
>>        my $ary=$Tmp->{myref};
>>        $Scratch->{found}="nothing";
>>        foreach $line(@$ary)
>>        {
>>                $Scratch->{found}="something!";
>>        }
>>[/perl]
>>[scratch found]<br>
>>    
>>
>
>- What db are you using? Postgres or MySQL?
>  
>
MySQL

>- If you are using for example postgres, do you get any output when you
>enter this query at the postgres prompt?
>
Yes, and it doesnt't complain about the syntax

>- If you using the default db (not any sql, postgres etc), then your query
>does not work.
>- Did you try [set .. instead of [seti...?
>- Did you try to add the query direct to the query tag (not via the
>scratch)?
>
Yep- i only had it set in a scratch variable so i could print it out to 
make sure there were no funny characters (originally the string did not 
have the value 252 hard coded in)

>- Do you get an output with an simpler query (select * from cattable)?
>  
>
Yep - it works fine with a simpler query. From what i understand from 
what Mike has said, the simpler queries are handled by a different module.

>Rene
>
>
>  
>