Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subqueries as a field expression?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00200658
Message ID:
00200685
Vues:
8
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform