Use merge tables, or two separate queries.
"Wix,Christian XCW" wrote:
>
> Hi
> I have two similar tables. (table1 & table2). They contain the columns
> "name", "distance" and "date". Table1 is year 2000 and Table2 year 2001.
>
> I need to get the total distance for each name.
> For year 2000 I would do this:
> select name, SUM(distance) from table1 group by name;
>
> How do I do it for both years? (one query)
>
> Thanks,
>
> // Chris - Copenhagen
>
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------------------
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