MySQL Forums
Forum List  »  Newbie

Re: QUERY not working use of subselects is too
Posted by: Roland Bouman
Date: July 13, 2005 05:22AM

You don't seem to need Table A at all, is that correct:

SELECT b.id
, b.sumAmount
, c.sumAmount
FROM (select id, sum(amount)
from B
group by id
) b
inner join (select id, sum(amount)
from C
group by id
) c
on b.id = c.id

I hope it helps, but if you're tables are properly indexed, it should not make too much of a difference

Options: ReplyQuote


Subject
Written By
Posted
Re: QUERY not working use of subselects is too
July 13, 2005 05:22AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.