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:
00200670
Views:
9
Hi Derek,

>Is there a way to use a subquery as a field expression in VFP5?
>ex:
>select CompanyName, (select sum(cost) from orders where custid = company.custid and cType = 'fruit') as TotalFruit, (select sum(cost) from orders where custid = company.custid and cType = 'beverage') as TotalBeverage from company order by CompanyName

I don't think so. But you could use Orders with two different alias names in the select and then sum those fields. Probably you need some sort of outer join here.

Christof
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform