Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subqueries as a field expression?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00200658
Message ID:
00200685
Views:
9
>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.

One more thing: if number of subselects is so high, it's probably faster to collect all data into one cursor with 3 fields:
CustId, cType, TotalCost
and then apply cross-tab here.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform