Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group By - Continued Help Needed
Message
From
17/03/2004 11:42:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
17/03/2004 11:27:14
N. Lea
Nic Cross Enterprises
Valencia, California, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00887107
Message ID:
00887117
Views:
13
>Hello,
>
>I have tried every suggestion that has been given to me regarding the whole "Group By" subject. However, I still do not seem to be accomplishing what VFP 6/7 was able to accomplish in VFP 8. I am beginning to wonder if it does work with this new SQL statement type. Everytime I attempt this "Group By" in any sense of my code, it still gives me the information seperately inside the grid. I attempted to re-write the code over and over again, but every version comes out the same or worse. I attempted the MAX() code into the fields, but destroyed my output data into figures that did not match up or correct figures that were placed multiple times.
>
>
>select id_desc,sum_ap_total ;
>from sql_ap_pre ;
>where ap_status = .pcStatus ;
>group by id_desc, sum_ap_total ;
>into cursor sql_ap readwrite
>
>
>The id_desc and totals are shown as:
>
>AP-MISC                        500.00
>AP-OFFICESUPPLIES              500.00
>AP-OFFICESUPPLIES              500.00
>AP-OFFICESUPPLIES             2000.00
>AP-COMPUTERS                  5000.00
>AP-COMPUTERS                  3000.00
>AP-COMPUTERS                  7000.00
>AP-COMPUTERS                  1500.00
>AP-OFFICESUPPLIES               50.00
>AP-MISC                       1000.00
>
>
>where as I am trying to accomplish:
>
>AP-COMPUTERS                  11500.00
>AP-OFFICESUPPLIES              3050.00
>AP-MISC                        1500.00
>
>
>I even narrowed this code down thinking that it was because I have more fields originally, but even when I now have only two fields, it does not come out right. Does anyone please have a solution for this in VFP 8 aside from using the 7 Engine to calculate correctly??
>
>Thank you so much!!

This works in 6/7 ? What's the logic behind grouping with an SQL like this ? I haven't seen your previous problem so there might be a logic in fact which I'm missing. Probably you meant to :

select distinct id_desc,sum_ap_total ;
from sql_ap_pre ;
where ap_status = .pcStatus ;
into cursor sql_ap readwrite

I don't see the point to use group by instead. Or you mean this ?

select id_desc,sum(sum_ap_total) as sum_ap_total ;
from sql_ap_pre ;
where ap_status = .pcStatus ;
group by id_desc ;
order by id_desc ;
into cursor sql_ap readwrite

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform