易截截图软件、单文件、免安装、纯绿色、仅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,
    


相关文档:

hibernate 生成的 sql 语句 ? 代值

转自: http://hi.baidu.com/beanchx/blog/item/ed056509d66f65cc3bc763f4.html
p6spy的替代品:jdbc logger
2007年09月13日 下午 01:07
首先介绍一下这个开源的项目。这个是一个对jdbc中的sql进行logger的一个工具。若在项目中采用了较多的preparedStatement,那么打印出来的sql会有很多"?",非常不方便。有一个产品为p ......

【总结】oracle恢复误删除数据,解除锁定的等sql语句

1.曾经不小心把开发库的数据库表全部删除,当时吓的要死。结果找到下面的语句恢复到了1个小时之前的数据!很简单。
注意使用管理员登录系统:
select * from 表名 as of timestamp sysdate-1/12 //查询两个小时前的某表数据!既然两小时以前的数据都得到了,继续怎么做,知道了吧。。

如果drop了表,怎么办??见下 ......

SQL Server连接远程数据源

SQL Server连接远程数据源的基本方法有下面三种:
OPENDATASOURCE
: The OPENDATASOURCE function is used to
specify connection information for a remote data source by specifying
the OLE DB provider and an initialization string. OPENDATASOURCE can be
used directly within a SELECT, INSERT, UPDATE, or ......

SQL经典组合查询

从博客园中看到一篇文章,介绍大软件公司面试时常常会出的两道SQL题(见附录)。
我觉得受益很多,在此之前,我一直觉得,SQL2008似乎提供了这方面的支持,但更低的版本,包括2005,非游标做不出来(水平够菜)。总结心得如下:
1、    强大的group by
1  select stdname,
2  isnull( ......

SQL Server 2005 中的Row_Number()函数

本文来自:http://www.cnblogs.com/digjim/archive/2006/09/20/509344.html
 我们知道,SQL Server 2005和SQL Server 2000 相比较,SQL Server 2005有很多新特性。这篇文章我们要讨论其中的一个新函数Row_Number()。数据库管理员和开发者已经期待这个函数很久了,现在终于等到了!
 通常,开发者和管理员在一个 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号