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

对pl/sql 语句的优化(下集)

上集中
//////////////////////////////////////////////////
select n5001 门店,n5002 部门,n5004 小分类,n5019 商品编码,c01d21 商品名称,
nvl(xse,0)-nvl(dzxs,0) 销售,
mle 毛利,
nvl(xl,0)-nvl(dzsl,0) 销量
 from
(select n5001,n5002,n5004,n5019,sum(n5011) xse,sum(n5016) mle,sum(n5023) xl
from n50
where n5010 between to_date('20100401','yyyymmdd') and to_date('20100430','yyyymmdd')
group by n5001,n5002,n5004,n5019),
(select g08,g09,g02,sum(g03*g07) dzxs,sum(G03) dzsl from batchgoods
where g04 between to_date('20100401','yyyymmdd') and to_date('20100430','yyyymmdd')
group by g08,g09,g02),c01d
where n5001=g08(+)
and n5019=g02(+)
and n5001=c01d00(+)
and n5019=c01d01(+)
SELECT STATEMENT, GOAL = CHOOSE            Cost=10163    Cardinality=30832    Bytes=3730672
 MERGE JOIN OUTER            Cost=10163    Cardinality=30832    Bytes=3730672
  MERGE JOIN OUTER            Cost=1794    Cardinality=30832    Bytes=2959872
   SORT JOIN            Cost=1743    Cardinality=30832    Bytes=1880752
    VIEW    Object owner=FZDC        Cost=1098    Cardinality=30832    Bytes=1880752
     SORT GROUP BY            Cost=1098    Cardinality=30832    Bytes=1171616
      TABLE ACCESS BY INDEX ROWID    Object owner=FZDC    Object name=N50    Cost=668    Cardinality=30832    Bytes=1171616
       INDEX RANGE SCAN    Object owner=FZDC&n


相关文档:

通过SQL代码收缩数据库

 
/*------------------------------------------------------------------
--  Author : htl258(Tony)
--  Date   : 2010-04-16 14:30:23
--  Version: Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
    Jul  9 2008 14:43:34
  &nb ......

sql server分布式事务解决方案

适用环境
操作系统:windows 2003
数据库:sql server 2000/sql server 2005
使用链接服务器进行远程数据库访问的情况
一、  问题现象
在执行分布式事务时,在sql server 2005下收到如下错误:
消息 7391,级别 16,状态 2,过程 xxxxx,第 16 行
无法执行该操作,因为链接服务器 "xxxxx" 的 OLE DB 访问接口 " ......

使用SQL*PLUS构建完美excel或html输出

转自:http://hong9270503.blog.163.com/blog/static/127292320091611319516/
通过SQL*PLUS我们可以构建友好的输出,满足多样化用户需求。
  
本例通过简单示例,介绍通过sql*plus输出xls,html两种格式文件.
   首先创建两个脚本:
  
1.main.sql
   用以设置环境,调用具体功能脚本
   2.功能脚本-ge ......

SQL求解八皇后问题(92种结果)

--该表保存结果
create table c(c1 tinyint, c2 tinyint, c3 tinyint, c4 tinyint, c5 tinyint, c6 tinyint, c7 tinyint, c8 tinyint, c9 tinyint, c10 tinyint, c11 tinyint, c12 tinyint, c13 tinyint, c14 tinyint, c15 tinyint, c16 tinyint, c17 tinyint, c18 tinyint, c19 tinyint, c20 tinyint, c21 tinyint, c22 t ......

Access 的 SQL 的记录间的加减计算

Access 的 SQL 中,计算相应编号的记录之间 加 减 的查询命令
例如 计算ID为 6 的 合计 减去 ID 为 2、3、4 以及加上 ID 为 5 的合计
SELECT SUM(R) AS 结果
from
(
  SELECT 合计  AS R from T1 WHERE (ID = 6) UNION
  SELECT -合计 AS R from T1 WHERE (ID = 2) UNION
  SELECT -合计 AS R f ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号