日期:2014-05-18  浏览次数:20334 次

sql 2000 多表查询
根据日期每天生成一个表,命名格式 Local_日期,例如Local_20120224,Local_20120225

表的格式是一样的,有字段类型为text的字段

现在要从这些表中查询所有数据

应该如何查询呢 ?

我尝试了一下

SQL code
select * from Local_20120224,Local_20120225 where SourceID = 'src:10104' and pType = 'Central'


或者

SQL code
select * from Local_20120224 where SourceID = 'src:10104' and pType = 'Central' union 
select * from Local_20120225 where SourceID = 'src:10104' and pType = 'Central' 


都不行



------解决方案--------------------
探讨

引用:

SQL code
select * from Local_20120224 where SourceID = 'src:10104' and pType = 'Central' union
select * from Local_20120225 where SourceID = 'src:10104' and pType = 'Centr……