>Would it work if changed to something like this?
>
>Select custid,sum(cost) as cost from orders into cursor tmp1 where cType = 'fruit' group by custid
>Select custid,sum(cost) as cost from orders into cursor tmp2 where cType = 'beverage' group by custid
>Select company.custid,companyname,tmp1.cost as fruitcost, tmp2.cost as BeverageCost From company LEFT JOIN tmp1 ON company.id=tmp1.custid LEFT JOIN tmp2 ON company.id = tmp2.custid
>Into cursor tmp3
>
>I am wondering if the syntax on the join would work since I have 12 actual subselects and the way that you originally had it would involve more temp cursors.
It should, but many joins in one statement may actually reduce speed. Usually, chain of isolated SELECTs work faster.
Edward Pikman
Independent Consultant