On Tue, 08 Feb 2005 15:52:02 +0100, Joachim Klöfers
<[EMAIL PROTECTED]> wrote:
> Oh, oh, Joachim,
> not able to calculate, but asking questions about queries.
> 
> Coz , of course its supposed to be 1955  (id 13 & 47)
> 
> Joachim
> 
> 
> Coz Web schrieb: 
> Just to confirm, is amount2 for region 1 supposed to be 1630 (id 47)
or 1955
> (ids 13 & 47)?

Thought I'd check I hadn't missed something.

Do the results *have* to be from a single query? I would suggest using
something like the previous query for amount1 and this for amount2 and
then combining them in your application.

SELECT region,  SUM(amount2)
FROM t1  LEFT JOIN  t3 USING(id)
GROUP BY region

This will (as I believe Daniel suggested) keep things relatively
simple, avoiding an overly complex query that you cannot maintain in
the future. That is, unless someone on this list provides a simple
single-query solution, which they very well may do.

HTH

Coz

-- 
CozWeb Solutions Ltd
http://www.cozweb.net

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

Reply via email to