读书人

sql 2000 多表查询解决思路

发布时间: 2012-03-16 16:34:56 作者: rapoo

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……

读书人网 >SQL Server

热点推荐