A union is designed to integrate two+ result sets into one. Can you not 
just join the tables together and perform a sum in the select clause?

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 3/2/04, 3:46:30 PM, Lorderon <[EMAIL PROTECTED]> wrote regarding 
UNION:


> Hello All,

> I want to sum a column from several tables while using UNION.. something
> like this:

> (SELECT SUM(price) FROM table1)
>     UNION
> (SELECT SUM(price) FROM table2)

> This results in 2 rows that sums each table seperatedly.. but I want to 
sum
> the column from both tables together..
> I usually have more than 2 tables to sum, and I sum different tables 
every
> time, so I can't define merge tables on every combination..

> Is there a way to sum the column from all tables together?


> thanks in advance,
> -Lorderon.



> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
http://lists.mysql.com/[EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to