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