Mysql data warehouse SQL Query Help please
I have the following database
db: exam_2011
tables: score_01, score_02, score_0开发者_如何学Go3.....score_12
db: exam_2012
tables: score_01, score_02, score_03.....score_12
the database is the year and the tables are the month;
How can I get the data between 1 July 2011 to 2 February 2012?
Please help to construct the query. The database server is mysql. Thanks. This is not homework or school stuff.
I assume that you have a column named day
in these tables:
select * from exam_2011.score_07
union all
select * from exam_2011.score_08
union all
select * from exam_2011.score_09
union all
select * from exam_2011.score_10
union all
select * from exam_2011.score_11
union all
select * from exam_2011.score_12
union all
select * from exam_2012.score_01
union all
select * from exam_2012.score_02 where day <= 2
精彩评论