Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need work around for Select Statement
Message
 
To
06/02/2007 03:47:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01192682
Message ID:
01192738
Views:
17
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform