I have 3 tables that have all fieds the same (name, length, indexes...)
The only difference is that data is stored by year(1999 in table1999, 2000 in 
table2000, 2001 in table2001)
I don't want to merge them because each contains about 15,000,000 records and the 
index would'nt fit into memmory...

What I would like to do is compare for example august 1999, august 2000 and august 
2001.

I do it like this:


create temporary table tmp
select * from table1999 where month(dDate)=8;

insert into tmp
select * from table2000 where month(dDate)=8;

insert into tmp
select * from table2001 where month(dDate)=8;

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?


Any ideas?

Tadej

Reply via email to