List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 18 2001 1:58am
Subject:Re: SQL query - not too complex?
View as plain text  
At 2:32 AM +0100 6/18/01, <mysql-lists@stripped> wrote:
>I need some help with a query to sum data for each id and write it into a
>new table.
>
>I have a source data table for each calendar month containing i.d.'s (not
>unique) and a value and I need to sum all the values for each i.d. for all
>months into a new table (where each i.d. will now be unique).

Sounds like you need to combine 12 separate tables into a single table
that has an additional column to indicate which month each row is for.
Then you should be able to sum the values easily.  Trying to do this
for bunch of separate tables will be difficult - many queries.

>
>The only way I could see of doing it was in two or more stages?
>
>Duncan


-- 
Paul DuBois, paul@stripped
Thread
SQL query - not too complex?mysql-lists18 Jun
  • Re: SQL query - not too complex?Paul DuBois18 Jun
  • Re: SQL query - not too complex?Benjamin Pflugmann18 Jun