Message
From
18/12/2006 09:19:44
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Sub Total
Miscellaneous
Thread ID:
01178537
Message ID:
01178537
Views:
80
Dear Experts

CREATE CURSOR testsub (name c(15),bill n(3),amount n(4))

INSERT INTO testsub VALUES ('John',1,500)
INSERT INTO testsub VALUES ('Eric',2,900)
INSERT INTO testsub VALUES ('Eric',3,300)
INSERT INTO testsub VALUES ('John',4,800)
INSERT INTO testsub VALUES ('Eric',5,200)
INSERT INTO testsub VALUES ('Bush',6,400)
INSERT INTO testsub VALUES ('Eric',7,700)
INSERT INTO testsub VALUES ('Bush',8,100)
INSERT INTO testsub VALUES ('John',9,600)


In a cursor, I need Sub-Total and Grand-Total as follows

Bush----6----400
Bush----8----100
sub-T---2----500
Eric----2----900
Eric----3----300
Eric----5----200
Eric----7----700
sub-T---4----2100
John----1----500
John----4----800
John----9----600
sub-T---3----1900
Grd-T--19----4500

Note: In the following line of sub total
sub-T---2----500

2 is number of bills and 500 is sum of both bills

Please help
Next
Reply
Map
View