Hi everyone,
I'm trying to run a query that sums information across tables.
I have a whole load of half hourly data and want to aggregate it at a monthly level, then report it across months.
I have a different table for each month of the year. Each table includes the amount of electricity for different generators across that month.
e.g. in the Jan 2012 table:
Gen 1 MWh Gen 2 MWh Gen 3 MWh
1/Jan/2012 0:00 50 100 200
1/Jan/2012 0:30 0 100 250
What I'd like to do is sum for each generator in each month and report them on a month-by-month basis, so taking three totals from each table to give an output like:
Gen 1 MWh Gen 2 MWh Gen 3 MWh
January 72000 148000 320000
February 55000 125000 280000
It's easy enough to build a query with the query builder that looks at one table, but as much as I've tried to fiddle with the SQL I can't make it output across several tables at once. The output is going to excel so it helps to have it all in one table and not in individual lines, each with a header.
This must seem like a bit of a newbie question but I'd really appreciate some help!
I've attached screenshots of the database in case it's a help.
Thanks in advance,
Paul
I'm trying to run a query that sums information across tables.
I have a whole load of half hourly data and want to aggregate it at a monthly level, then report it across months.
I have a different table for each month of the year. Each table includes the amount of electricity for different generators across that month.
e.g. in the Jan 2012 table:
Gen 1 MWh Gen 2 MWh Gen 3 MWh
1/Jan/2012 0:00 50 100 200
1/Jan/2012 0:30 0 100 250
What I'd like to do is sum for each generator in each month and report them on a month-by-month basis, so taking three totals from each table to give an output like:
Gen 1 MWh Gen 2 MWh Gen 3 MWh
January 72000 148000 320000
February 55000 125000 280000
It's easy enough to build a query with the query builder that looks at one table, but as much as I've tried to fiddle with the SQL I can't make it output across several tables at once. The output is going to excel so it helps to have it all in one table and not in individual lines, each with a header.
This must seem like a bit of a newbie question but I'd really appreciate some help!
I've attached screenshots of the database in case it's a help.
Thanks in advance,
Paul