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

写了一个稍微复杂点的sql心得

select pcode from (
        select h.k,h.d,h.m,h.u,l.areacode,
               l.areacode||substr(h.u,4,length(h.u))||h.k pcode
         from(
        select j.k,j.d,j.m,j.u from(
        select lpad(f,3,0) as k,d, m,u from(
        select xx.areacode d,nvl(count(cy.pcode),'001')f,mx.m,mx.shopcode u
        from cz_s_jtxx xx, cz_s_jtcy cy , 
          ( select a.m,d.shopid,d.shopcode from
        (select shopid m,parentid from s_shop where shoptype=1) a,
        (select shopid,parentid from s_shop where shoptype=2) b,
        (select shopid,parentid from s_shop where shoptype=3)c,
        (select shopid,parentid,shopcode from s_shop where shoptype=4)d
        where d.parentid=c.shopid
        and c.parentid=b.shopid
        and b.parentid=a.m
        and d.shopid=14725) mx
        where xx.pcode = cy.pcode
        and xx.areacode=mx.shopid
        group by xx.areacode,mx.m,mx.shopcode))j)h, 
        (select areacode,shopid  from cz_s_area) l 
       where h.m=l.shopid)
首先 从最里层的 sql说起:
select a.m,d.shopid,d.shopcode from
        (select shopid m,parentid from s_shop where shoptype=1) a,
    


相关文档:

Java防止SQL注入

 SQL注入是最常见的攻击方式之一,它不是利用操作系统或其它系统的漏洞来实现攻击的,而是程序员因为没有做好判断,被不法
用户钻了SQL的空子,下面我们先来看下什么是SQL注入:
          比如在一个登陆界面,要求用户输入用户名和密码:
     & ......

在 MS SQL Server 中删除表

-- 说明:
-- 1. 要删除表 table_name, 须先判断该表是否正被数据库中其它表所引用.
-- 2. 如果未被引用, 可直接 DROP TABLE table_name; 否则必须先删除引用表的约束, 再 DROP TABLE table_name.
-- 3. 另外, table_name 是否正引用其它表的情况无须考虑.


-- 创建主表
CREATE TABLE tParent
......

sql中的like


执行 数据库查询时,有完整查询和模糊查询之分。
一般模糊语句如下:
SELECT 字段 from 表 WHERE 某字段 Like 条件
其中关于条件,SQL提供了四种匹配模式:
1,%:表示任意0个或多个字符。可匹配任意类型和长度的字符,有些情况下若是中文,请运用两个百分号(%%)表示。
比如 SELECT * from [user] WHERE u_na ......

SQl 2005 For XMl 简单查询(Raw,Auto,Path模式)(2)

文章导航 SQL Server 2005 学习笔记系列文章导航
     在SQl 2005 For XMl 简单查询(Raw,Auto,Path模式)(1) 里我们说了关于Path,Raw和Auto模式的用法,其实里面不仅仅 是这些简单的操作,还有一些其它的特性,比如说Type或OpenXml方法,sp_xml_preparedocument存储过程 等这些增加的东东,我们来一 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号