首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql 2000 多表查询解决思路

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

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

热点排行