日期:2014-05-17  浏览次数:20454 次

如何select 多个相同结构的表并把结果合并放在一起 ...
多个表相同结构的表,按天生成,如Table1001,Table1002, Table1003......

select * from table1001 where price > 10
select * from table1002 where price > 10
select * from table1003 where price > 10

是可以的,但这样的话,有几个表就存在几个结果,处理起来很麻烦。



select * from table1001, table1002, table1003 where price > 10

报错。

求助,怎样才能在一个语句中查询多个相同结构的表,并且把结果放在一个cursor里,看起来就象从一个表中查询出来的一样?
select 合并

------解决方案--------------------
select xxx from xxx where xxx
union all 
select xxx from xxxx where xxx
union all
select xxx from xxx where xxx
这样的格式