ASP如何实现多表查询?

来源:百度知道 编辑:UC知道 时间:2024/06/05 08:08:41
我的数据库中分别有六个表:a,b,c,d,e,f,g
六个表的字段名都包括:title和time
我希望能在网页中点击查询,可以显示所有表中的字段title的内容?
请高手给出代码!谢谢!

select * from a where title like 'x' and time >'10/21/2006'
union
select * from b where title like 'x' and time >'10/21/2006'
union
select * from c where title like 'x' and time >'10/21/2006'
union
select * from d where title like 'x' and time >'10/21/2006'

.....

思路就是这样的

Select a,title,b.title,c.title,d.title e.title,f.title,g.title from a,b,c,d,e where a.time >'10/21/2006' or b.time >'10/21/2006' or c.time >'10/21/2006' or d.time >'10/21/2006' or e.time >'10/21/2006' or f.time >'10/21/2006' or g.time >'10/21/2006'