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

高手们帮忙优化下一个SQL语句

  如题,
  我自己优化了下,但是结果还是与客户的要求有一定的差距。
  表的数据量比较大,相关搜索字段的索引都建了。大家帮忙优化下SQL语句。
  以下是最原始的SQL:
  SQL code:

select fileid,contentid,filepath,filetype,transferstatus,usagecode,codeformat,coderate,nettype,playurl,destpath
from (select z.fileid, z.contentid,z.filepath,z.filetype,z.transferstatus,z.usagecode,z.codeformat,
z.coderate, z.nettype,z.playurl,z.destpath
from (select t.fileid,t.contentid,t.filepath,t.filetype,
1 transferstatus,2 usagecode,t.codeformat,10 coderate ,t.nettype,t.playurl, null destpath
from t_cms_mtv_file@dblink_cms t, t_cms_mtv@dblink_cms a
where t.filetype is null
and t.codeformat = '7'
and t.coderate = '30'
and t.nettype = '3'
and t.contentid = a.contentid
and a.type = 2
) z
where z.contentid not in (select b.contentid
from (select t.contentid
from t_cms_mtv_file@dblink_cms t, t_cms_mtv@dblink_cms a


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

sql性能求助 - MS-SQL Server / 疑难问题

场景如下:
客户把备份好的数据库,发给我,我在本机还原后,运行写好的存储过程,比较快,并且在实施那边运行同样比较快。但是当实施在客户那边运行的时候速度就非常的慢,时间超出了程序的时间限制。远程在客户那 ......

求一sql语句 - MS-SQL Server / 疑难问题

现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......

求一sql语句 - MS-SQL Server / 基础类


id bh  
1 10
2 11
3 12 
4 15
5 16
6 22
7 25
8 26
9 27
10 28
将bh按连续分段出来返回字符串:
10~12,15~16,22,25~28
SQL code:


declare @t tabl ......

求一SQL - MS-SQL Server / 基础类

tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号