[snip]
No, they have different record numbers...
[/snip]

a. Always reply to the list. I just happened to spot this in my spam
folder while cleaning.

2. You're getting Cartesian results, so your query needs to be a little
more specific....

Your original query --

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

try this (not tested)

SELECT (SUM(table1.qty) + SUM(table2.qty)) as val, table1.name
FROM table1 LEFT OUTER JOIN table2
ON(table1.identifier = table2.identifier)
GROUP BY table1.name
ORDER BY val DESC

You may have to do 2 queries with

(1)WHERE table2.identifier IS NULL  //or (2)IS NOT NULL

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

Reply via email to