Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub Total and Grand Total in Table
Message
 
 
To
06/07/2006 20:39:37
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01134324
Message ID:
01134334
Views:
8
>Dear Experts
>
>Following are tow columns in Table1, Field1 has products and Fileld2 has quantity
>A-----------60
>A-----------45
>A-----------20
>B-----------40
>B-----------35
>B-----------85
>B-----------15
>C-----------12
>C-----------18
>
>In table I want to get sub totals of every category and then Grand Total at the end of the Table as below
>
>A-----------60
>A-----------45
>A-----------20
>sub total--125
>B-----------40
>B-----------35
>B-----------85
>B-----------15
>sub total--175
>C-----------12
>C-----------18
>sub total---30
>Grand total-330
>
>Please help
select cName, Qty from Table1 ;
union all ;
select padr("sub total",50) as cName, sum(qty) as Qty from table1 group by 1 ;
union all ;
select padr("Grand total",50) as cName, sum(gty) as Qty from table1 ;
into table tableNew 
I'm not sure how to create the records in the right order, though.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform