Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement
Message
 
 
To
03/05/2000 09:32:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00365519
Message ID:
00365663
Views:
20
>Hi,
> Thank you. How about the result as the following?
>
>
>Report
>Total Table1       Total Table2        Total Table3
>3000                7000               13000
>
>
>Thank you

John,

<PRE>
SELECT ;
		SUM(Amount1) AS Amount1, Sum(0) AS Amount2, SUM(0) AS Amount3;
	FROM Table1 ;	
UNION SELECT ;
		SUM(0) AS Amount1, Sum(Amount2) AS Amount2, SUM(0) AS Amount3;
	FROM Table2 ;	
UNION SELECT ;
		SUM(0) AS Amount1, Sum(0) AS Amount2, SUM(Amount3) AS Amount3;
	FROM Table3 ;
INTO CURSOR Amounts	

SELECT ;
		SUM(Amount1) AS Amount, Sum(Amount2) AS Amount2, SUM(Amount3) AS Amount3;
	FROM Amounts ;
	INTO CURSOR Summary	
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform