Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Confuse with grouping
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Confuse with grouping
Miscellaneous
Thread ID:
00843323
Message ID:
00843323
Views:
78
I am trying to group information by getting total AMT for each SSN number. I tried the following but it doesn't work in vfp8. I get group by clause missing error. Here is my code:
SELECT Sarptp.name, Sarptp.ssn, SUM(Sarptp.amt), Sarptp.agency;
 FROM ti!sarptp;
 GROUP BY Sarptp.ssn;
 ORDER BY Sarptp.name
when I rewrite this to following:
SELECT Sarptp.name, Sarptp.ssn, SUM(Sarptp.amt), Sarptp.agency;
 FROM ti!sarptp;
 GROUP BY Sarptp.ssn, Sarptp.ti, Sarptp.name, Sarptp.agency;
 ORDER BY Sarptp.name
it totals my ANT right for each SSN. Can some clarify how it knows that I am trying total by SSN number vs lets say NAME (or other fields in group by clause)? Is it the order of precedence, in this instance the SSN being first field in group by? what about all the other fields in group by, does sql look at those? Sorry for asking stupid questions, I usually don't use group by in vfp 8 because they confuse me.

thanks
nick
Next
Reply
Map
View

Click here to load this message in the networking platform