>>Hi All,
>>
>> Iam a foxpro 2.6 user, now iam trying out VFP 9. In foxpro 2.6 we can use an aggregate function and select for example max date and value of transaction on that date. Now in Vfp 9, they have refined the select statement, when there is a aggregate function in a select statement, we have to include the selected fields in group by, otherwise i am getting group by clause is invalid.
>>
>>
>>Is there a work around for this? The old bug was very useful in one way, but it may create some problem when getting records, if you forget to handle it properly.
>>
>>
>>Thanks in Advance
>>
>>
>>Babu R
>
>It's really a terrible solution which I strongly advice against, but here it is! Set enginebehavor 80 (or 70)
One other work-around is to apply a min/max on any other field that you know won't change or otherwise be impacted, such as a customers name on an order... If all details are for the same customer, you could do something like
select a.custno, max( b.custname ) as custname, max( a.date ) as lastdate ;
from orders a, customers b;
where a.custno = b.custno;
group by 1
it works and doesn't break non-aggregation rules as part of group by