对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
相关文档:
DECLARE @HDOC INT --文档句柄
DECLARE @XMLSTRING VARCHAR(200) --XML字符串
SET @xmlString ='<?xml version="1.0"?>
<ROOT>
<USER ID="1" Name="SBQCEL"/>
<USER ID="2" Name="PEACELI"/>
<USER ID="3" Name="SHEEPCHANG"/>
</ROOT>'
--使用系统存储 ......
/*------------------------------------------------------------------
-- 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 ......
随着Visual Studio 2010的发布,Microsoft SQL Server Compact 3.5也升级为Microsoft
SQL Server Compact SP2。
下载地址如下:
SQL
Server Compact 3.5 SP2 for Windows mobile devices (all platforms &
processors)
SQL
Server Compact 3.5 SP2 for Windows desktop (32-bit and 64-bit)
  ......
如图1、2,id=1的数据是NULL,其他的为非NULL的数据。
一般情况下,会用两种方法!
方法1.t-sql:insert into E values(1,'NULL'),插入后,在打开表的情况下看到的
是'NULL'(我想是为了区分NULL,才加的引号),但是查询的时候不影响,显示的是NULL,
如图1、2,id为6的数据。
如果要插入带单引号的'NULL',insert i ......
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 ......