站内模糊搜索 代码问题

来源:百度知道 编辑:UC知道 时间:2024/05/30 13:39:12
我想要在同一个数据库里查询 2个表 我的代码只能查询一个 表 要怎么实现2个表呢 查询的字段都一样title 和content 以下是代码 高手帮下谢谢 tAutoKey="Select * from T_Sample where U_Name like '%" & strKey & "%' or U_Info like '%" & strKey & "%'" & strNew1 & strNew2

select * from a where a1 like '%StrKey%'
union all
select * from b where b1 like '%StrKey%'

得到的数据是第一个表和第二个表的资料,
这种用法是指两个表基本相同并且没有关系,可以使用这种方法。