"Tadej Guzej" <[EMAIL PROTECTED]> wrote:
> select year(dDate), month(dDate), avg(zPrice), sum(zPrice)
> ... from tmp group by year(dDate), month(dDate);
>
> Is there a way to do this without using a temporary table?

You can use a join.

SELECT *
FROM table1, table2, table3
WHERE month(dDate)=8
AND table1.key = table2.key
AND table1.key = table3.key
GROUP BY ...

The key will likely be your dDate field.  And of course you want to make
sure you dDate is indexed, especially for such large tables.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to