易截截图软件、单文件、免安装、纯绿色、仅160KB

sql语句多表多字段查询 - MS-SQL Server / 基础类

我有多个表A B C 结构是一样的,都有2个字段name和content,我要搜索所以表所有字段中包含“中国”的内容 这个SQL语句怎么写 

如何将多个表的查询结果连成一个表 这个SQL语句怎么写 表的结构是一样的
例如:key=request.form("key") 
set rs=server.createobject("adodb.recordset")
sql = "select * from toutiao where title like '%"&key& "%' or content like '%"&key& "%' "
sql = "select * from xinxi where title like '%"&key& "%' or content like '%"&key& "%' "
。。。。

就是将上多个SQL变成一句

select * from (select name,content from A union all select name,content from B union all select name,content from C) where name like '%中国%' or content like '%中国%'

select A.name, A.content, B.name, B.content, C.name, C.content from A,B,C where name like '%中国%' or content like '%中国%'

SQL code:

select * from a where name like '%中国%' or content like '%中国%'
union all
select * from b where name like '%中国%' or content like '%中国%'
union all
select * from c where name like '%中国%' or content like '%中国%'



顶一个!!


相关问答:

sql server 存储过程循环赋值的问题

小弟是个新手 现在有个问题一直不能解决
例如
procedure produce_proc
    @p001 nvarchar(8000),
    @p002 nvarchar(8000),
    @p003 nvarchar(8000),
  & ......

总会碰到怪的问题,sql问题

sql2005
select *from v_ddxx where d_sfsc='0' and (g_ssbm='1001' or g_ssbm='1002') and (xxf>0 and  xxfwzf <>0 ),执行速度慢的要死,但是如果把(xxf>0 and  ......

SQL语句效率问题 - 其他数据库开发 / 其他数据库

大家帮忙看看这2个sql语句哪个查询的速度更快点。谢谢帮忙。比较着急。在做性能测试。
select * from
  表A LEFT OUTER JOIN 表B ON (表A.id || ' ' =表B.id) ,表C , 表D, 表E
Where其他条件
select * ......

SQL字段,横向展开

请问各位,如何将SQl中,某字段中的值横向展开呢,
CASE WHEN

具体问题具体分析,看你要怎么展开

姓名  科目      成绩
张三  英语    90
李四  英语&nb ......

access 中执行sql语句update不成功,求助!!!

access 中执行sql update语句时有时候成功有时候不成功,但是access中不出错误信息,不知道是什么原因,有哪位大侠知道,请帮忙啊
贴SQL语句,检查表、字段的有效性设置

sql 在查询分析器里面 执行很正常

是 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号