I have 2 tables, identical in fields.  One is an 'archived items' table, the
other is a live items.

I want to run a query that will grab the sum of all products in both tables,
like:

The results would display the total qty by item:

QTY NAME

The logic is something like:

sum(table1.qty) + sum(table2.qty)

The query that I came up with is:

select (sum(table1.qty) + sum(table2.qty)) as val,name from table1,table2
group by name order by val desc


It is just a bit off... (like 30000 off the actual count :) )

I have tried to do it with a where and group by clause, but no luck there
either...

Any suggestions?

TIA!

--
Cheers

Mike Morton

****************************************************
*
* Tel: 905-465-1263
* Email: [EMAIL PROTECTED]
*
****************************************************

"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey 



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

Reply via email to