Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select from 2 tables
Message
 
 
To
20/05/2002 15:25:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00659056
Message ID:
00659155
Views:
17
You can first get summary for each table and add it to the cummulative cursor. After that you can summarize data into resulting cursor. Something like ( not tested)
DIMENSION laTableList[20]
laTableList[1]  = "table1"
laTableList[2]  = "table2"
...
laTableList[19]  = "table19"
laTableList[20]  = "table20"

FOR i=1 TO ALEN(laTableList)
	SELECT cell, ;
		SUM(field1) AS SumField1, ;
		...					;
		SUM(fieldN) AS SumFieldN ;
		FROM (laTableList(i)) ;
		GROUP BY cell ;
		INTO CURSOR crsTemp
	IF i=1
		Afields(laFields)
		CREATE CURSOR crsCumulative FROM ARRAY laFields
	ENDIF
	SELECT crsCumulative 
	APPEND FROM ( Dbf("crsTemp") )
ENDFOR

SELECT cell, ;
	SUM(SumField1) AS SumField1, ;
	...					;
	SUM(SumFieldN) AS SumFieldN ;
	FROM crsCumulative ;
	GROUP BY cell ;
	INTO CURSOR crsResult
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform