用存储过程
CREATE PROCEDURE `proc_GetTable`(in p_datetime datetime)
BEGIN
if(p_datetime >'1990-1-1' and p_datetime<'1995-12-31') then
select * from table1;
elseif(p_datetime>'1996-1-1' and p_datetime <'2000-12-31') then
select * from table2;
else
select * from table3;
end if;
END